2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/resource.h>
34 #include DEF_MPERS_TYPE(rusage_t)
36 typedef struct rusage rusage_t;
40 MPERS_PRINTER_DECL(void, printrusage, struct tcb *tcp, long addr)
44 if (umove_or_printaddr(tcp, addr, &ru))
47 tprintf("{ru_utime={%llu, %llu}, ru_stime={%llu, %llu}, ",
48 widen_to_ull(ru.ru_utime.tv_sec),
49 widen_to_ull(ru.ru_utime.tv_usec),
50 widen_to_ull(ru.ru_stime.tv_sec),
51 widen_to_ull(ru.ru_stime.tv_usec));
55 tprintf("ru_maxrss=%llu, ", widen_to_ull(ru.ru_maxrss));
56 tprintf("ru_ixrss=%llu, ", widen_to_ull(ru.ru_ixrss));
57 tprintf("ru_idrss=%llu, ", widen_to_ull(ru.ru_idrss));
58 tprintf("ru_isrss=%llu, ", widen_to_ull(ru.ru_isrss));
59 tprintf("ru_minflt=%llu, ", widen_to_ull(ru.ru_minflt));
60 tprintf("ru_majflt=%llu, ", widen_to_ull(ru.ru_majflt));
61 tprintf("ru_nswap=%llu, ", widen_to_ull(ru.ru_nswap));
62 tprintf("ru_inblock=%llu, ", widen_to_ull(ru.ru_inblock));
63 tprintf("ru_oublock=%llu, ", widen_to_ull(ru.ru_oublock));
64 tprintf("ru_msgsnd=%llu, ", widen_to_ull(ru.ru_msgsnd));
65 tprintf("ru_msgrcv=%llu, ", widen_to_ull(ru.ru_msgrcv));
66 tprintf("ru_nsignals=%llu, ", widen_to_ull(ru.ru_nsignals));
67 tprintf("ru_nvcsw=%llu, ", widen_to_ull(ru.ru_nvcsw));
68 tprintf("ru_nivcsw=%llu}", widen_to_ull(ru.ru_nivcsw));
74 printrusage32(struct tcb *tcp, long addr)
81 struct timeval32 ru_utime; /* user time used */
82 struct timeval32 ru_stime; /* system time used */
83 long ru_maxrss; /* maximum resident set size */
84 long ru_ixrss; /* integral shared memory size */
85 long ru_idrss; /* integral unshared data size */
86 long ru_isrss; /* integral unshared stack size */
87 long ru_minflt; /* page reclaims */
88 long ru_majflt; /* page faults */
89 long ru_nswap; /* swaps */
90 long ru_inblock; /* block input operations */
91 long ru_oublock; /* block output operations */
92 long ru_msgsnd; /* messages sent */
93 long ru_msgrcv; /* messages received */
94 long ru_nsignals; /* signals received */
95 long ru_nvcsw; /* voluntary context switches */
96 long ru_nivcsw; /* involuntary " */
99 if (umove_or_printaddr(tcp, addr, &ru))
102 tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ",
103 (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
104 (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
108 tprintf("ru_maxrss=%lu, ", ru.ru_maxrss);
109 tprintf("ru_ixrss=%lu, ", ru.ru_ixrss);
110 tprintf("ru_idrss=%lu, ", ru.ru_idrss);
111 tprintf("ru_isrss=%lu, ", ru.ru_isrss);
112 tprintf("ru_minflt=%lu, ", ru.ru_minflt);
113 tprintf("ru_majflt=%lu, ", ru.ru_majflt);
114 tprintf("ru_nswap=%lu, ", ru.ru_nswap);
115 tprintf("ru_inblock=%lu, ", ru.ru_inblock);
116 tprintf("ru_oublock=%lu, ", ru.ru_oublock);
117 tprintf("ru_msgsnd=%lu, ", ru.ru_msgsnd);
118 tprintf("ru_msgrcv=%lu, ", ru.ru_msgrcv);
119 tprintf("ru_nsignals=%lu, ", ru.ru_nsignals);
120 tprintf("ru_nvcsw=%lu, ", ru.ru_nvcsw);
121 tprintf("ru_nivcsw=%lu}", ru.ru_nivcsw);