blob: 51f62759bea9fd23a5158e19f42b5480fde60e29 [file] [log] [blame]
Shailabh Nagarc7572492006-07-14 00:24:40 -07001/* taskstats.h - exporting per-task statistics
2 *
3 * Copyright (C) Shailabh Nagar, IBM Corp. 2006
4 * (C) Balbir Singh, IBM Corp. 2006
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it would be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 */
14
15#ifndef _LINUX_TASKSTATS_H
16#define _LINUX_TASKSTATS_H
17
18/* Format for per-task data returned to userland when
19 * - a task exits
20 * - listener requests stats for a task
21 *
22 * The struct is versioned. Newer versions should only add fields to
23 * the bottom of the struct to maintain backward compatibility.
24 *
25 *
26 * To add new fields
27 * a) bump up TASKSTATS_VERSION
28 * b) add comment indicating new version number at end of struct
29 * c) add new fields after version comment; maintain 64-bit alignment
30 */
31
32#define TASKSTATS_VERSION 1
33
34struct taskstats {
35
36 /* Version 1 */
37 __u64 version;
38};
39
40
41#define TASKSTATS_LISTEN_GROUP 0x1
42
43/*
44 * Commands sent from userspace
45 * Not versioned. New commands should only be inserted at the enum's end
46 * prior to __TASKSTATS_CMD_MAX
47 */
48
49enum {
50 TASKSTATS_CMD_UNSPEC = 0, /* Reserved */
51 TASKSTATS_CMD_GET, /* user->kernel request/get-response */
52 TASKSTATS_CMD_NEW, /* kernel->user event */
53 __TASKSTATS_CMD_MAX,
54};
55
56#define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1)
57
58enum {
59 TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */
60 TASKSTATS_TYPE_PID, /* Process id */
61 TASKSTATS_TYPE_TGID, /* Thread group id */
62 TASKSTATS_TYPE_STATS, /* taskstats structure */
63 TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */
64 TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */
65 __TASKSTATS_TYPE_MAX,
66};
67
68#define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1)
69
70enum {
71 TASKSTATS_CMD_ATTR_UNSPEC = 0,
72 TASKSTATS_CMD_ATTR_PID,
73 TASKSTATS_CMD_ATTR_TGID,
74 __TASKSTATS_CMD_ATTR_MAX,
75};
76
77#define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1)
78
79/* NETLINK_GENERIC related info */
80
81#define TASKSTATS_GENL_NAME "TASKSTATS"
82#define TASKSTATS_GENL_VERSION 0x1
83
84#endif /* _LINUX_TASKSTATS_H */