getrusage(2): zero out ru_i[xds]rss fields
The current values were both inaccurate (especially for dynamically linked executables) and using the wrong unit (bytes, instead of kilobytes times ticks-of-execution). For now we are better off not populating these fields at all. Change-Id: I195a8fa8db909e64a833eec25f59c9ee0b89bdc5
This commit is contained in:
parent
0f5c95a00b
commit
cd27b2627a
5 changed files with 0 additions and 31 deletions
|
@ -217,9 +217,6 @@ int pm_exec(vir_bytes path, size_t path_len, vir_bytes frame, size_t frame_len,
|
||||||
execi.args.stack_high = minix_get_user_sp();
|
execi.args.stack_high = minix_get_user_sp();
|
||||||
execi.args.stack_size = DEFAULT_STACK_LIMIT;
|
execi.args.stack_size = DEFAULT_STACK_LIMIT;
|
||||||
|
|
||||||
fp->text_size = 0;
|
|
||||||
fp->data_size = 0;
|
|
||||||
|
|
||||||
lookup_init(&resolve, fullpath, PATH_NOFLAGS, &execi.vmp, &execi.vp);
|
lookup_init(&resolve, fullpath, PATH_NOFLAGS, &execi.vmp, &execi.vp);
|
||||||
|
|
||||||
resolve.l_vmnt_lock = VMNT_READ;
|
resolve.l_vmnt_lock = VMNT_READ;
|
||||||
|
@ -381,8 +378,6 @@ int pm_exec(vir_bytes path, size_t path_len, vir_bytes frame, size_t frame_len,
|
||||||
|
|
||||||
/* Remember the new name of the process */
|
/* Remember the new name of the process */
|
||||||
strlcpy(fp->fp_name, execi.args.progname, PROC_NAME_LEN);
|
strlcpy(fp->fp_name, execi.args.progname, PROC_NAME_LEN);
|
||||||
fp->text_size = execi.args.text_size;
|
|
||||||
fp->data_size = execi.args.data_size;
|
|
||||||
|
|
||||||
pm_execfinal:
|
pm_execfinal:
|
||||||
if(newfilp) unlock_filp(newfilp);
|
if(newfilp) unlock_filp(newfilp);
|
||||||
|
|
|
@ -55,9 +55,6 @@ EXTERN struct fproc {
|
||||||
int fp_vp_rdlocks; /* number of read-only locks on vnodes */
|
int fp_vp_rdlocks; /* number of read-only locks on vnodes */
|
||||||
int fp_vmnt_rdlocks; /* number of read-only locks on vmnts */
|
int fp_vmnt_rdlocks; /* number of read-only locks on vmnts */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vir_bytes text_size; /* text segment size of current process */
|
|
||||||
vir_bytes data_size; /* data segment size of current process */
|
|
||||||
} fproc[NR_PROCS];
|
} fproc[NR_PROCS];
|
||||||
|
|
||||||
/* fp_flags */
|
/* fp_flags */
|
||||||
|
|
|
@ -975,9 +975,6 @@ int do_getrusage(void)
|
||||||
|
|
||||||
r_usage.ru_inblock = 0;
|
r_usage.ru_inblock = 0;
|
||||||
r_usage.ru_oublock = 0;
|
r_usage.ru_oublock = 0;
|
||||||
r_usage.ru_ixrss = fp->text_size;
|
|
||||||
r_usage.ru_idrss = fp->data_size;
|
|
||||||
r_usage.ru_isrss = DEFAULT_STACK_LIMIT;
|
|
||||||
|
|
||||||
return sys_datacopy_wrapper(SELF, (vir_bytes) &r_usage, who_e,
|
return sys_datacopy_wrapper(SELF, (vir_bytes) &r_usage, who_e,
|
||||||
m_in.m_lc_vfs_rusage.addr, (phys_bytes) sizeof(r_usage));
|
m_in.m_lc_vfs_rusage.addr, (phys_bytes) sizeof(r_usage));
|
||||||
|
|
|
@ -68,20 +68,11 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage1, ru_utime.tv_sec);
|
CHECK_NOT_ZERO_FIELD(r_usage1, ru_utime.tv_sec);
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage1, ru_maxrss);
|
CHECK_NOT_ZERO_FIELD(r_usage1, ru_maxrss);
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage1, ru_ixrss);
|
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage1, ru_idrss);
|
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage1, ru_isrss);
|
|
||||||
if (getrusage(RUSAGE_CHILDREN, &r_usage2) != 0) {
|
if (getrusage(RUSAGE_CHILDREN, &r_usage2) != 0) {
|
||||||
e(1);
|
e(1);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage2, ru_maxrss);
|
CHECK_NOT_ZERO_FIELD(r_usage2, ru_maxrss);
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage2, ru_ixrss);
|
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage2, ru_idrss);
|
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage2, ru_isrss);
|
|
||||||
CHECK_EQUAL_FIELD(r_usage1, r_usage2, ru_ixrss);
|
|
||||||
CHECK_EQUAL_FIELD(r_usage1, r_usage2, ru_idrss);
|
|
||||||
CHECK_EQUAL_FIELD(r_usage1, r_usage2, ru_isrss);
|
|
||||||
if ((child = fork()) == 0) {
|
if ((child = fork()) == 0) {
|
||||||
/*
|
/*
|
||||||
* We cannot do this part of the test in the parent, since
|
* We cannot do this part of the test in the parent, since
|
||||||
|
@ -110,12 +101,6 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage3, ru_utime.tv_sec);
|
CHECK_NOT_ZERO_FIELD(r_usage3, ru_utime.tv_sec);
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage3, ru_maxrss);
|
CHECK_NOT_ZERO_FIELD(r_usage3, ru_maxrss);
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage3, ru_ixrss);
|
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage3, ru_idrss);
|
|
||||||
CHECK_NOT_ZERO_FIELD(r_usage3, ru_isrss);
|
|
||||||
CHECK_EQUAL_FIELD(r_usage1, r_usage3, ru_ixrss);
|
|
||||||
CHECK_EQUAL_FIELD(r_usage1, r_usage3, ru_idrss);
|
|
||||||
CHECK_EQUAL_FIELD(r_usage1, r_usage3, ru_isrss);
|
|
||||||
}
|
}
|
||||||
quit();
|
quit();
|
||||||
|
|
||||||
|
|
|
@ -1349,11 +1349,6 @@ vfs_getrusage_in(struct trace_proc * proc, const message * m_out,
|
||||||
put_value(proc, "ru_inblock", "%ld", buf.ru_inblock);
|
put_value(proc, "ru_inblock", "%ld", buf.ru_inblock);
|
||||||
put_value(proc, "ru_oublock", "%ld", buf.ru_oublock);
|
put_value(proc, "ru_oublock", "%ld", buf.ru_oublock);
|
||||||
}
|
}
|
||||||
if (verbose > 0) {
|
|
||||||
put_value(proc, "ru_ixrss", "%ld", buf.ru_ixrss);
|
|
||||||
put_value(proc, "ru_idrss", "%ld", buf.ru_idrss);
|
|
||||||
put_value(proc, "ru_isrss", "%ld", buf.ru_isrss);
|
|
||||||
}
|
|
||||||
|
|
||||||
put_close_struct(proc, verbose > 1);
|
put_close_struct(proc, verbose > 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue