#[derive(Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct HugetlbEventStatistics
{
pub number_of_allocation_failures_due_to_the_maximum_limit: usize,
}
impl HugetlbEventStatistics
{
#[inline(always)]
pub(crate) fn from_file(file_path: &Path) -> Result<Self, StatisticsParseError>
{
let mut max = None;
parse_key_value_statistics(file_path, &mut |name, value|
{
match name
{
b"max" =>
{
max = Some(value);
}
_ => (),
};
Ok(())
})?;
Ok
(
Self
{
number_of_allocation_failures_due_to_the_maximum_limit: unwrap_statistic(max, b"max")?,
}
)
}
}