Skip to content

Commit

Permalink
Omit more empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars T Hansen committed Jan 13, 2025
1 parent a153502 commit 9c6537b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl Object {
Object { fields: vec![] }
}

pub fn is_empty(&self) -> bool {
self.fields.is_empty()
}

pub fn push(&mut self, tag: &str, value: Value) {
self.fields.push(Field {
tag: tag.to_string(),
Expand Down
4 changes: 3 additions & 1 deletion src/ps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ fn do_create_snapshot(
s = add_key(s, "memz", cards, |c: &gpu::CardState| {
nonzero(c.mem_clock_mhz.into())
});
gpu_info = Some(s);
if !s.is_empty() {
gpu_info = Some(s);
}
}
}
match gpu.get_process_utilization(&user_by_pid) {
Expand Down

0 comments on commit 9c6537b

Please sign in to comment.