-
Notifications
You must be signed in to change notification settings - Fork 3
/
uinteger.h
40 lines (29 loc) · 1.16 KB
/
uinteger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef UINTEGER_H
#define UINTEGER_H
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
struct top_uinteger {
bool is_negative;
uint64_t value;
};
/* this indicates whether the sample being collected is the first
* so that no +/- is shown next to statistics when the first sample
* is being displayed
*/
extern bool first_sample;
struct top_uinteger top_init_uinteger(uint64_t value, bool is_negative);
struct top_uinteger top_sub_uinteger(const struct top_uinteger *a, const struct top_uinteger *b);
bool top_humanize_uinteger(char *buf, size_t bufsize, const struct top_uinteger i);
bool top_sprint_uinteger(char *buf, size_t bufsize, struct top_uinteger i);
struct top_uinteger top_uinteger_calc_result(uint64_t now, uint64_t prev, uint64_t beg);
/*
* These return true in the case of a buffer overflow.
* If the value has changed since the previous sample,
* they will display a + or - to the right of the sample.
*/
bool top_uinteger_format_result(
char *buf, size_t bufsize, uint64_t now, uint64_t prev, uint64_t beg);
bool top_uinteger_format_mem_result(
char *buf, size_t bufsize, uint64_t now, uint64_t prev, uint64_t beg);
#endif /*UINTEGER_H*/