Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F34024043
test-getrusage.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
test-getrusage.c
View Options
#include
<stdio.h>
#include
<stdlib.h>
#include
<sys/resource.h>
int
main
(
int
argc
,
char
**
argv
)
{
struct
rusage
buf
;
if
(
argc
>
1
)
{
system
(
argv
[
1
]);
if
(
getrusage
(
RUSAGE_CHILDREN
,
&
buf
))
{
perror
(
"getrusage"
);
return
1
;
}
}
else
{
if
(
getrusage
(
RUSAGE_SELF
,
&
buf
))
{
perror
(
"getrusage"
);
return
1
;
}
}
printf
(
"ru_utime = %ld.%06ld
\n
"
,
buf
.
ru_utime
.
tv_sec
,
buf
.
ru_utime
.
tv_usec
);
printf
(
"ru_stime = %ld.%06ld
\n
"
,
buf
.
ru_stime
.
tv_sec
,
buf
.
ru_stime
.
tv_usec
);
printf
(
"ru_maxrss = %ld
\n
"
,
buf
.
ru_maxrss
);
printf
(
"ru_ixrss = %ld
\n
"
,
buf
.
ru_ixrss
);
printf
(
"ru_idrss = %ld
\n
"
,
buf
.
ru_idrss
);
printf
(
"ru_isrss = %ld
\n
"
,
buf
.
ru_isrss
);
printf
(
"ru_minflt = %ld
\n
"
,
buf
.
ru_minflt
);
printf
(
"ru_majflt = %ld
\n
"
,
buf
.
ru_majflt
);
printf
(
"ru_nswap = %ld
\n
"
,
buf
.
ru_nswap
);
printf
(
"ru_inblock = %ld
\n
"
,
buf
.
ru_inblock
);
printf
(
"ru_oublock = %ld
\n
"
,
buf
.
ru_oublock
);
printf
(
"ru_msgsnd = %ld
\n
"
,
buf
.
ru_msgsnd
);
printf
(
"ru_msgrcv = %ld
\n
"
,
buf
.
ru_msgrcv
);
printf
(
"ru_nsignals= %ld
\n
"
,
buf
.
ru_nsignals
);
printf
(
"ru_nvcsw = %ld
\n
"
,
buf
.
ru_nvcsw
);
printf
(
"ru_nivcsw = %ld
\n
"
,
buf
.
ru_nivcsw
);
return
0
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sat, Nov 29, 7:01 AM (1 d, 3 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
dd/da/bc7852fd4b39c41bdaf05decf0fc
Attached To
rC libgcrypt
Event Timeline
Log In to Comment