add mi_process_info api call

This commit is contained in:
daan 2020-09-06 13:21:19 -07:00
parent 4355ab7d20
commit ee286919d9
3 changed files with 80 additions and 38 deletions

View file

@ -13,7 +13,7 @@ static void corrupt_free();
static void block_overflow1();
static void invalid_free();
static void test_aslr(void);
static void test_process_info(void);
int main() {
mi_version();
@ -45,6 +45,7 @@ int main() {
//p2 = malloc(32);
//mi_free(p2);
mi_stats_print(NULL);
test_process_info();
return 0;
}
@ -131,3 +132,15 @@ static void test_aslr(void) {
p[1] = malloc(1134626);
printf("p1: %p, p2: %p\n", p[0], p[1]);
}
static void test_process_info(void) {
double utime = 0;
double stime = 0;
size_t current_rss = 0;
size_t peak_rss = 0;
size_t current_commit = 0;
size_t peak_commit = 0;
size_t page_faults = 0;
mi_process_info(&utime, &stime, &current_rss, &peak_rss, &current_commit, &peak_commit, &page_faults);
printf("process info: user: %.3f s, rss: %zd b, commit: %zd b\n\n", utime, peak_rss, peak_commit);
}