summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2006-11-16 13:08:29 -0800
committerNathan Binkert <binkertn@umich.edu>2006-11-16 13:08:29 -0800
commit4c2e65c94e2c66daf4be8c424c84002c63693ca2 (patch)
tree5e68f89d0681b4337d269e2841752d314c0eb5d5
parent31d829d388824c6795009afa55610ea5f5a22b0c (diff)
downloadgem5-4c2e65c94e2c66daf4be8c424c84002c63693ca2.tar.xz
implement RUSAGE_CHILDREN for getrusage since it's trivial
--HG-- extra : convert_revision : bc12b3b2e9ee02f42c437cbc20680ea00e19a801
-rw-r--r--src/sim/syscall_emul.hh31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 07689ef06..27356c9f1 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -934,17 +934,8 @@ getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
int who = tc->getSyscallArg(0); // THREAD, SELF, or CHILDREN
TypedBufferArg<typename OS::rusage> rup(tc->getSyscallArg(1));
- if (who != OS::TGT_RUSAGE_SELF) {
- // don't really handle THREAD or CHILDREN, but just warn and
- // plow ahead
- warn("getrusage() only supports RUSAGE_SELF. Parameter %d ignored.",
- who);
- }
-
- getElapsedTime(rup->ru_utime.tv_sec, rup->ru_utime.tv_usec);
- rup->ru_utime.tv_sec = htog(rup->ru_utime.tv_sec);
- rup->ru_utime.tv_usec = htog(rup->ru_utime.tv_usec);
-
+ rup->ru_utime.tv_sec = 0;
+ rup->ru_utime.tv_usec = 0;
rup->ru_stime.tv_sec = 0;
rup->ru_stime.tv_usec = 0;
rup->ru_maxrss = 0;
@@ -962,6 +953,24 @@ getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
rup->ru_nvcsw = 0;
rup->ru_nivcsw = 0;
+ switch (who) {
+ case OS::TGT_RUSAGE_SELF:
+ getElapsedTime(rup->ru_utime.tv_sec, rup->ru_utime.tv_usec);
+ rup->ru_utime.tv_sec = htog(rup->ru_utime.tv_sec);
+ rup->ru_utime.tv_usec = htog(rup->ru_utime.tv_usec);
+ break;
+
+ case OS::TGT_RUSAGE_CHILDREN:
+ // do nothing. We have no child processes, so they take no time.
+ break;
+
+ default:
+ // don't really handle THREAD or CHILDREN, but just warn and
+ // plow ahead
+ warn("getrusage() only supports RUSAGE_SELF. Parameter %d ignored.",
+ who);
+ }
+
rup.copyOut(tc->getMemPort());
return 0;