Branch data Line data Source code
1 : : /*
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>
6 : : * All rights reserved.
7 : : *
8 : : * Redistribution and use in source and binary forms, with or without
9 : : * modification, are permitted provided that the following conditions
10 : : * are met:
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.
18 : : *
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.
29 : : */
30 : :
31 : : #include "defs.h"
32 : : #include <sys/resource.h>
33 : :
34 : : #include DEF_MPERS_TYPE(rusage_t)
35 : :
36 : : typedef struct rusage rusage_t;
37 : :
38 : : #include MPERS_DEFS
39 : :
40 : 174 : MPERS_PRINTER_DECL(void, printrusage,
41 : : struct tcb *const tcp, const kernel_ulong_t addr)
42 : : {
43 : : rusage_t ru;
44 : :
45 [ + + ]: 174 : if (umove_or_printaddr(tcp, addr, &ru))
46 : 30 : return;
47 : :
48 : 144 : tprints("{ru_utime=");
49 : 144 : MPERS_FUNC_NAME(print_struct_timeval)(&ru.ru_utime);
50 : 144 : tprints(", ru_stime=");
51 : 144 : MPERS_FUNC_NAME(print_struct_timeval)(&ru.ru_stime);
52 [ + + ]: 144 : if (abbrev(tcp))
53 : 66 : tprints(", ...");
54 : : else {
55 : : #define PRINT_RUSAGE_MEMBER(member) \
56 : : tprintf(", " #member "=%llu", zero_extend_signed_to_ull(ru.member))
57 : 78 : PRINT_RUSAGE_MEMBER(ru_maxrss);
58 : 78 : PRINT_RUSAGE_MEMBER(ru_ixrss);
59 : 78 : PRINT_RUSAGE_MEMBER(ru_idrss);
60 : 78 : PRINT_RUSAGE_MEMBER(ru_isrss);
61 : 78 : PRINT_RUSAGE_MEMBER(ru_minflt);
62 : 78 : PRINT_RUSAGE_MEMBER(ru_majflt);
63 : 78 : PRINT_RUSAGE_MEMBER(ru_nswap);
64 : 78 : PRINT_RUSAGE_MEMBER(ru_inblock);
65 : 78 : PRINT_RUSAGE_MEMBER(ru_oublock);
66 : 78 : PRINT_RUSAGE_MEMBER(ru_msgsnd);
67 : 78 : PRINT_RUSAGE_MEMBER(ru_msgrcv);
68 : 78 : PRINT_RUSAGE_MEMBER(ru_nsignals);
69 : 78 : PRINT_RUSAGE_MEMBER(ru_nvcsw);
70 : 78 : PRINT_RUSAGE_MEMBER(ru_nivcsw);
71 : : #undef PRINT_RUSAGE_MEMBER
72 : : }
73 : 144 : tprints("}");
74 : : }
75 : :
76 : : #ifdef ALPHA
77 : : void
78 : : printrusage32(struct tcb *const tcp, const kernel_ulong_t addr)
79 : : {
80 : : struct rusage32 {
81 : : timeval32_t ru_utime; /* user time used */
82 : : timeval32_t 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 " */
97 : : } ru;
98 : :
99 : : if (umove_or_printaddr(tcp, addr, &ru))
100 : : return;
101 : :
102 : : tprints("{ru_utime=");
103 : : print_timeval32_t(&ru.ru_utime);
104 : : tprints(", ru_stime=");
105 : : print_timeval32_t(&ru.ru_stime);
106 : : if (abbrev(tcp))
107 : : tprints(", ...");
108 : : else {
109 : : # define PRINT_RUSAGE_MEMBER(member) \
110 : : tprintf(", " #member "=%lu", ru.member)
111 : : PRINT_RUSAGE_MEMBER(ru_maxrss);
112 : : PRINT_RUSAGE_MEMBER(ru_ixrss);
113 : : PRINT_RUSAGE_MEMBER(ru_idrss);
114 : : PRINT_RUSAGE_MEMBER(ru_isrss);
115 : : PRINT_RUSAGE_MEMBER(ru_minflt);
116 : : PRINT_RUSAGE_MEMBER(ru_majflt);
117 : : PRINT_RUSAGE_MEMBER(ru_nswap);
118 : : PRINT_RUSAGE_MEMBER(ru_inblock);
119 : : PRINT_RUSAGE_MEMBER(ru_oublock);
120 : : PRINT_RUSAGE_MEMBER(ru_msgsnd);
121 : : PRINT_RUSAGE_MEMBER(ru_msgrcv);
122 : : PRINT_RUSAGE_MEMBER(ru_nsignals);
123 : : PRINT_RUSAGE_MEMBER(ru_nvcsw);
124 : : PRINT_RUSAGE_MEMBER(ru_nivcsw);
125 : : # undef PRINT_RUSAGE_MEMBER
126 : : }
127 : : tprints("}");
128 : : }
129 : : #endif
|