mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
add mi_process_info api call
This commit is contained in:
parent
4355ab7d20
commit
ee286919d9
3 changed files with 80 additions and 38 deletions
|
@ -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, ¤t_rss, &peak_rss, ¤t_commit, &peak_commit, &page_faults);
|
||||
printf("process info: user: %.3f s, rss: %zd b, commit: %zd b\n\n", utime, peak_rss, peak_commit);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue