tracehook_notify_death: use task_detached() helper
[linux-2.6/mini2440.git] / include / linux / taskstats.h
blob341dddb55090853430c39bd76a081bc2125c8fe5
1 /* taskstats.h - exporting per-task statistics
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
5 * (C) Jay Lan, SGI, 2006
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2.1 of the GNU Lesser General Public License
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it would be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 #ifndef _LINUX_TASKSTATS_H
17 #define _LINUX_TASKSTATS_H
19 #include <linux/types.h>
21 /* Format for per-task data returned to userland when
22 * - a task exits
23 * - listener requests stats for a task
25 * The struct is versioned. Newer versions should only add fields to
26 * the bottom of the struct to maintain backward compatibility.
29 * To add new fields
30 * a) bump up TASKSTATS_VERSION
31 * b) add comment indicating new version number at end of struct
32 * c) add new fields after version comment; maintain 64-bit alignment
36 #define TASKSTATS_VERSION 7
37 #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
38 * in linux/sched.h */
40 struct taskstats {
42 /* The version number of this struct. This field is always set to
43 * TAKSTATS_VERSION, which is defined in <linux/taskstats.h>.
44 * Each time the struct is changed, the value should be incremented.
46 __u16 version;
47 __u32 ac_exitcode; /* Exit status */
49 /* The accounting flags of a task as defined in <linux/acct.h>
50 * Defined values are AFORK, ASU, ACOMPAT, ACORE, and AXSIG.
52 __u8 ac_flag; /* Record flags */
53 __u8 ac_nice; /* task_nice */
55 /* Delay accounting fields start
57 * All values, until comment "Delay accounting fields end" are
58 * available only if delay accounting is enabled, even though the last
59 * few fields are not delays
61 * xxx_count is the number of delay values recorded
62 * xxx_delay_total is the corresponding cumulative delay in nanoseconds
64 * xxx_delay_total wraps around to zero on overflow
65 * xxx_count incremented regardless of overflow
68 /* Delay waiting for cpu, while runnable
69 * count, delay_total NOT updated atomically
71 __u64 cpu_count __attribute__((aligned(8)));
72 __u64 cpu_delay_total;
74 /* Following four fields atomically updated using task->delays->lock */
76 /* Delay waiting for synchronous block I/O to complete
77 * does not account for delays in I/O submission
79 __u64 blkio_count;
80 __u64 blkio_delay_total;
82 /* Delay waiting for page fault I/O (swap in only) */
83 __u64 swapin_count;
84 __u64 swapin_delay_total;
86 /* cpu "wall-clock" running time
87 * On some architectures, value will adjust for cpu time stolen
88 * from the kernel in involuntary waits due to virtualization.
89 * Value is cumulative, in nanoseconds, without a corresponding count
90 * and wraps around to zero silently on overflow
92 __u64 cpu_run_real_total;
94 /* cpu "virtual" running time
95 * Uses time intervals seen by the kernel i.e. no adjustment
96 * for kernel's involuntary waits due to virtualization.
97 * Value is cumulative, in nanoseconds, without a corresponding count
98 * and wraps around to zero silently on overflow
100 __u64 cpu_run_virtual_total;
101 /* Delay accounting fields end */
102 /* version 1 ends here */
104 /* Basic Accounting Fields start */
105 char ac_comm[TS_COMM_LEN]; /* Command name */
106 __u8 ac_sched __attribute__((aligned(8)));
107 /* Scheduling discipline */
108 __u8 ac_pad[3];
109 __u32 ac_uid __attribute__((aligned(8)));
110 /* User ID */
111 __u32 ac_gid; /* Group ID */
112 __u32 ac_pid; /* Process ID */
113 __u32 ac_ppid; /* Parent process ID */
114 __u32 ac_btime; /* Begin time [sec since 1970] */
115 __u64 ac_etime __attribute__((aligned(8)));
116 /* Elapsed time [usec] */
117 __u64 ac_utime; /* User CPU time [usec] */
118 __u64 ac_stime; /* SYstem CPU time [usec] */
119 __u64 ac_minflt; /* Minor Page Fault Count */
120 __u64 ac_majflt; /* Major Page Fault Count */
121 /* Basic Accounting Fields end */
123 /* Extended accounting fields start */
124 /* Accumulated RSS usage in duration of a task, in MBytes-usecs.
125 * The current rss usage is added to this counter every time
126 * a tick is charged to a task's system time. So, at the end we
127 * will have memory usage multiplied by system time. Thus an
128 * average usage per system time unit can be calculated.
130 __u64 coremem; /* accumulated RSS usage in MB-usec */
131 /* Accumulated virtual memory usage in duration of a task.
132 * Same as acct_rss_mem1 above except that we keep track of VM usage.
134 __u64 virtmem; /* accumulated VM usage in MB-usec */
136 /* High watermark of RSS and virtual memory usage in duration of
137 * a task, in KBytes.
139 __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */
140 __u64 hiwater_vm; /* High-water VM usage, in KB */
142 /* The following four fields are I/O statistics of a task. */
143 __u64 read_char; /* bytes read */
144 __u64 write_char; /* bytes written */
145 __u64 read_syscalls; /* read syscalls */
146 __u64 write_syscalls; /* write syscalls */
147 /* Extended accounting fields end */
149 #define TASKSTATS_HAS_IO_ACCOUNTING
150 /* Per-task storage I/O accounting starts */
151 __u64 read_bytes; /* bytes of read I/O */
152 __u64 write_bytes; /* bytes of write I/O */
153 __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */
155 __u64 nvcsw; /* voluntary_ctxt_switches */
156 __u64 nivcsw; /* nonvoluntary_ctxt_switches */
158 /* time accounting for SMT machines */
159 __u64 ac_utimescaled; /* utime scaled on frequency etc */
160 __u64 ac_stimescaled; /* stime scaled on frequency etc */
161 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */
163 /* Delay waiting for memory reclaim */
164 __u64 freepages_count;
165 __u64 freepages_delay_total;
170 * Commands sent from userspace
171 * Not versioned. New commands should only be inserted at the enum's end
172 * prior to __TASKSTATS_CMD_MAX
175 enum {
176 TASKSTATS_CMD_UNSPEC = 0, /* Reserved */
177 TASKSTATS_CMD_GET, /* user->kernel request/get-response */
178 TASKSTATS_CMD_NEW, /* kernel->user event */
179 __TASKSTATS_CMD_MAX,
182 #define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1)
184 enum {
185 TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */
186 TASKSTATS_TYPE_PID, /* Process id */
187 TASKSTATS_TYPE_TGID, /* Thread group id */
188 TASKSTATS_TYPE_STATS, /* taskstats structure */
189 TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */
190 TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */
191 __TASKSTATS_TYPE_MAX,
194 #define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1)
196 enum {
197 TASKSTATS_CMD_ATTR_UNSPEC = 0,
198 TASKSTATS_CMD_ATTR_PID,
199 TASKSTATS_CMD_ATTR_TGID,
200 TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
201 TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
202 __TASKSTATS_CMD_ATTR_MAX,
205 #define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1)
207 /* NETLINK_GENERIC related info */
209 #define TASKSTATS_GENL_NAME "TASKSTATS"
210 #define TASKSTATS_GENL_VERSION 0x1
212 #endif /* _LINUX_TASKSTATS_H */