On Thu, Feb 18, 2016 at 04:04:57PM +0800, Fei Jie wrote: [...] > diff --git a/tests/getrusage.c b/tests/getrusage.c > new file mode 100644 > index 0000000..eea0168 > --- /dev/null > +++ b/tests/getrusage.c > @@ -0,0 +1,38 @@ > +#include "tests.h" > +#include <sys/syscall.h> > + > +#ifdef __NR_getrusage > + > +#include <sched.h>
Do you really need <sched.h> to test getrusage? > +#include <stdio.h> > +#include <sys/resource.h> > +#include <unistd.h> Please indent. > + > +int > +main(void) > +{ > + struct rusage usage; > + int rc = syscall(__NR_getrusage, RUSAGE_SELF, &usage); > + printf("getrusage(RUSAGE_SELF, {ru_utime={%ld, %ld}" > + ", ru_stime={%ld, %ld}, ru_maxrss=%ld, ru_ixrss=%ld" > + ", ru_idrss=%ld, ru_isrss=%ld, ru_minflt=%ld" > + ", ru_majflt=%ld, ru_nswap=%ld, ru_inblock=%ld" > + ", ru_oublock=%ld, ru_msgsnd=%ld, ru_msgrcv=%ld" > + ", ru_nsignals=%ld, ru_nvcsw=%ld, ru_nivcsw=%ld}) = %d\n", > + usage.ru_utime.tv_sec, usage.ru_utime.tv_usec, > + usage.ru_stime.tv_sec, usage.ru_stime.tv_usec, > + usage.ru_maxrss, usage.ru_ixrss, usage.ru_idrss, > + usage.ru_isrss, usage.ru_minflt, usage.ru_majflt, > + usage.ru_nswap, usage.ru_inblock, usage.ru_oublock, > + usage.ru_msgsnd, usage.ru_msgrcv, usage.ru_nsignals, > + usage.ru_nvcsw, usage.ru_nivcsw, rc); While all integer members of struct rusage have type "long", I believe they should be printed using "%lu" format instead of "%ld". -- ldv
pgpXk2hcRpZgq.pgp
Description: PGP signature
------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel