mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Replace the procfs by libproc
This commit is contained in:
parent
d78ada07b5
commit
02dcaf07db
6 changed files with 100 additions and 90 deletions
|
@ -322,18 +322,6 @@ impl<'a> ProfilerMarker for SpanMarker<'a> {
|
|||
format: MarkerFieldFormat::Bytes,
|
||||
searchable: false,
|
||||
}),
|
||||
MarkerSchemaField::Dynamic(MarkerDynamicField {
|
||||
key: "shared",
|
||||
label: "Number of resident shared pages (i.e., backed by a file) while this function was executing",
|
||||
format: MarkerFieldFormat::Bytes,
|
||||
searchable: false,
|
||||
}),
|
||||
MarkerSchemaField::Dynamic(MarkerDynamicField {
|
||||
key: "oom_score",
|
||||
label: "The current score that the kernel gives to this process for the purpose of selecting a process for the OOM-killer while this function was executing",
|
||||
format: MarkerFieldFormat::Integer,
|
||||
searchable: false,
|
||||
}),
|
||||
];
|
||||
|
||||
MarkerSchema {
|
||||
|
@ -366,10 +354,8 @@ impl<'a> ProfilerMarker for SpanMarker<'a> {
|
|||
"thread_id": thread_id,
|
||||
});
|
||||
|
||||
if let Some(MemoryStats { resident, shared, oom_score }) = self.memory_delta {
|
||||
if let Some(MemoryStats { resident }) = self.memory_delta {
|
||||
value["resident"] = json!(resident);
|
||||
value["shared"] = json!(shared);
|
||||
value["oom_score"] = json!(oom_score);
|
||||
}
|
||||
|
||||
value
|
||||
|
@ -423,18 +409,6 @@ impl<'a> ProfilerMarker for EventMarker<'a> {
|
|||
format: MarkerFieldFormat::Bytes,
|
||||
searchable: false,
|
||||
}),
|
||||
MarkerSchemaField::Dynamic(MarkerDynamicField {
|
||||
key: "shared",
|
||||
label: "Number of resident shared pages (i.e., backed by a file) while this function was executing",
|
||||
format: MarkerFieldFormat::Bytes,
|
||||
searchable: false,
|
||||
}),
|
||||
MarkerSchemaField::Dynamic(MarkerDynamicField {
|
||||
key: "oom_score",
|
||||
label: "The current score that the kernel gives to this process for the purpose of selecting a process for the OOM-killer while this function was executing",
|
||||
format: MarkerFieldFormat::Integer,
|
||||
searchable: false,
|
||||
}),
|
||||
];
|
||||
|
||||
MarkerSchema {
|
||||
|
@ -467,10 +441,8 @@ impl<'a> ProfilerMarker for EventMarker<'a> {
|
|||
"thread_id": thread_id,
|
||||
});
|
||||
|
||||
if let Some(MemoryStats { resident, shared, oom_score }) = self.memory_delta {
|
||||
if let Some(MemoryStats { resident }) = self.memory_delta {
|
||||
value["resident"] = json!(resident);
|
||||
value["shared"] = json!(shared);
|
||||
value["oom_score"] = json!(oom_score);
|
||||
}
|
||||
|
||||
value
|
||||
|
|
|
@ -188,9 +188,8 @@ fn print_duration(duration: std::time::Duration) -> String {
|
|||
}
|
||||
|
||||
/// Format only the allocated bytes, deallocated bytes and reallocated bytes in GiB, MiB, KiB, Bytes.
|
||||
fn print_memory(MemoryStats { resident, shared, oom_score }: MemoryStats) -> String {
|
||||
fn print_memory(MemoryStats { resident }: MemoryStats) -> String {
|
||||
use byte_unit::Byte;
|
||||
let rss_bytes = Byte::from_bytes(resident).get_appropriate_unit(true);
|
||||
let shared_bytes = Byte::from_bytes(shared).get_appropriate_unit(true);
|
||||
format!("RSS {rss_bytes:.2}, Shared {shared_bytes:.2}, OOM score {oom_score}")
|
||||
format!("RSS {rss_bytes:.2}")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue