Hello community,
here is the log from the commit of package delayacct-utils
checked in at Fri Aug 24 01:00:52 CEST 2007.
--------
--- delayacct-utils/delayacct-utils.changes 2007-07-11 14:52:26.000000000 +0200
+++ /mounts/work_src_done/STABLE/delayacct-utils/delayacct-utils.changes 2007-08-22 15:08:13.000000000 +0200
@@ -1,0 +2,5 @@
+Wed Aug 22 14:59:50 CEST 2007 - meissner@suse.de
+
+- updated to kernel level 2.6.22 (as in openSUSE 10.3).
+
+-------------------------------------------------------------------
Old:
----
delayacct-utils-0.2.tar.bz2
New:
----
delayacct-utils-0.3.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ delayacct-utils.spec ++++++
--- /var/tmp/diff_new_pack.Y27024/_old 2007-08-24 01:00:13.000000000 +0200
+++ /var/tmp/diff_new_pack.Y27024/_new 2007-08-24 01:00:13.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package delayacct-utils (Version 0.2)
+# spec file for package delayacct-utils (Version 0.3)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -13,8 +13,8 @@
Name: delayacct-utils
BuildRequires: libnl libnl-devel
Summary: Delay Accounting Utilities
-Version: 0.2
-Release: 26
+Version: 0.3
+Release: 1
Group: System/Monitoring
License: GPL v2 only
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -55,6 +55,8 @@
%attr(444,root,root) %{_mandir}/man?/*
%changelog
+* Wed Aug 22 2007 - meissner@suse.de
+- updated to kernel level 2.6.22 (as in openSUSE 10.3).
* Wed Jul 11 2007 - meissner@suse.de
- adjusted getdelays.c to be GPL v2 only, like the
linux kernel.
++++++ delayacct-utils-0.2.tar.bz2 -> delayacct-utils-0.3.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/delayacct-utils-0.2/getdelays.c new/delayacct-utils-0.3/getdelays.c
--- old/delayacct-utils-0.2/getdelays.c 2007-07-11 14:52:01.000000000 +0200
+++ new/delayacct-utils-0.3/getdelays.c 2007-08-22 15:07:18.000000000 +0200
@@ -1,9 +1,14 @@
-/* Genetlink test: user program
+/* getdelays.c
*
- * Illustrates usage of NETLINK_GENERIC interface to delay accounting
+ * Utility to get per-pid and per-tgid delay accounting statistics
+ * Also illustrates usage of the taskstats interface
*
+ * Copyright (C) Shailabh Nagar, IBM Corp. 2005
* Copyright (C) Balbir Singh, IBM Corp. 2006
- * Copyright (C) Shailabh Nagar, IBM Corp. 2006
+ * Copyright (c) Jay Lan, SGI. 2006
+ *
+ * Compile with
+ * gcc -I/usr/src/linux/include getdelays.c -o getdelays
*
* This program is derived from getdelays.c in the Linux kernel source
* and so the kernel license applies.
@@ -33,38 +38,173 @@
#include
#include
#include
-#include
#include
-#include
-#include
-#include
-#include
-#include
#include
#include
-#define MAX_CPUS 32
-#define debug(x...) printf(x)
+/*
+ * Generic macros for dealing with netlink sockets. Might be duplicated
+ * elsewhere. It is recommended that commercial grade applications use
+ * libnl or libnetlink and use the interfaces provided by the library
+ */
+#define GENLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
+#define GENLMSG_PAYLOAD(glh) (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
+#define NLA_DATA(na) ((void *)((char*)(na) + NLA_HDRLEN))
+#define NLA_PAYLOAD(len) (len - NLA_HDRLEN)
+
+#define err(code, fmt, arg...) \
+ do { \
+ fprintf(stderr, fmt, ##arg); \
+ exit(code); \
+ } while (0)
+
+int done;
+int rcvbufsz;
+char name[100];
+int dbg;
+int print_delays;
+int print_io_accounting;
+__u64 stime, utime;
+
+#define PRINTF(fmt, arg...) { \
+ if (dbg) { \
+ printf(fmt, ##arg); \
+ } \
+ }
-#define err(code, fmt, arg...) do { fprintf(stderr, fmt, ##arg); exit(code); } while (0)
-int done = 0;
+/* Maximum size of response requested or message sent */
+#define MAX_MSG_SIZE 1024
+/* Maximum number of cpus expected to be specified in a cpumask */
+#define MAX_CPUS 32
+
+struct msgtemplate {
+ struct nlmsghdr n;
+ struct genlmsghdr g;
+ char buf[MAX_MSG_SIZE];
+};
+
+char cpumask[100+6*MAX_CPUS];
+
+static void usage(void)
+{
+ fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] "
+ "[-m cpumask] [-t tgid] [-p pid]\n");
+ fprintf(stderr, " -d: print delayacct stats\n");
+ fprintf(stderr, " -i: print IO accounting (works only with -p)\n");
+ fprintf(stderr, " -l: listen forever\n");
+ fprintf(stderr, " -v: debug on\n");
+}
/*
* Create a raw netlink socket and bind
*/
-static struct nl_handle *create_nl_socket(void)
+static int create_nl_socket(int protocol)
{
- struct nl_handle *nlh;
- nlh = nl_handle_alloc();
- if (nlh) {
- nl_disable_sequence_check(nlh);
- nl_connect(nlh, NETLINK_GENERIC);
+ int fd;
+ struct sockaddr_nl local;
+
+ fd = socket(AF_NETLINK, SOCK_RAW, protocol);
+ if (fd < 0)
+ return -1;
+
+ if (rcvbufsz)
+ if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
+ &rcvbufsz, sizeof(rcvbufsz)) < 0) {
+ fprintf(stderr, "Unable to set socket rcv buf size "
+ "to %d\n",
+ rcvbufsz);
+ return -1;
+ }
+
+ memset(&local, 0, sizeof(local));
+ local.nl_family = AF_NETLINK;
+
+ if (bind(fd, (struct sockaddr *) &local, sizeof(local)) < 0)
+ goto error;
+
+ return fd;
+error:
+ close(fd);
+ return -1;
+}
+
+
+int send_cmd(int sd, __u16 nlmsg_type, __u32 nlmsg_pid,
+ __u8 genl_cmd, __u16 nla_type,
+ void *nla_data, int nla_len)
+{
+ struct nlattr *na;
+ struct sockaddr_nl nladdr;
+ int r, buflen;
+ char *buf;
+
+ struct msgtemplate msg;
+
+ msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
+ msg.n.nlmsg_type = nlmsg_type;
+ msg.n.nlmsg_flags = NLM_F_REQUEST;
+ msg.n.nlmsg_seq = 0;
+ msg.n.nlmsg_pid = nlmsg_pid;
+ msg.g.cmd = genl_cmd;
+ msg.g.version = 0x1;
+ na = (struct nlattr *) GENLMSG_DATA(&msg);
+ na->nla_type = nla_type;
+ na->nla_len = nla_len + 1 + NLA_HDRLEN;
+ memcpy(NLA_DATA(na), nla_data, nla_len);
+ msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len);
+
+ buf = (char *) &msg;
+ buflen = msg.n.nlmsg_len ;
+ memset(&nladdr, 0, sizeof(nladdr));
+ nladdr.nl_family = AF_NETLINK;
+ while ((r = sendto(sd, buf, buflen, 0, (struct sockaddr *) &nladdr,
+ sizeof(nladdr))) < buflen) {
+ if (r > 0) {
+ buf += r;
+ buflen -= r;
+ } else if (errno != EAGAIN)
+ return -1;
}
- return nlh;
+ return 0;
}
-static inline void print_taskstats(struct taskstats *t)
+
+/*
+ * Probe the controller in genetlink to find the family id
+ * for the TASKSTATS family
+ */
+int get_family_id(int sd)
+{
+ struct {
+ struct nlmsghdr n;
+ struct genlmsghdr g;
+ char buf[256];
+ } ans;
+
+ int id, rc;
+ struct nlattr *na;
+ int rep_len;
+
+ strcpy(name, TASKSTATS_GENL_NAME);
+ rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
+ CTRL_ATTR_FAMILY_NAME, (void *)name,
+ strlen(TASKSTATS_GENL_NAME)+1);
+
+ rep_len = recv(sd, &ans, sizeof(ans), 0);
+ if (ans.n.nlmsg_type == NLMSG_ERROR ||
+ (rep_len < 0) || !NLMSG_OK((&ans.n), rep_len))
+ return 0;
+
+ na = (struct nlattr *) GENLMSG_DATA(&ans);
+ na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
+ if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
+ id = *(__u16 *) NLA_DATA(na);
+ }
+ return id;
+}
+
+void print_delayacct(struct taskstats *t)
{
printf("\n\nCPU %15s%15s%15s%15s\n"
" %15llu%15llu%15llu%15llu\n"
@@ -80,226 +220,66 @@
"count", "delay total", t->swapin_count, t->swapin_delay_total);
}
-/*
- * Probe the controller in genetlink to find the family id
- * for the TASKSTATS family
- */
-int get_family_id(struct nl_handle *nlh)
-{
- struct nlmsghdr req = {
- .nlmsg_type = GENL_ID_CTRL,
- };
- struct nlmsghdr *rep;
- struct genlmsghdr genlh;
- struct nl_msg *msg;
- fd_set nlhs;
- int sd;
- int ret;
- struct timeval tv;
- struct sockaddr_nl peer;
- unsigned char *rmsg;
- int n;
- struct nlattr *nla;
- int id = -1;
- int len;
-
- /* Get family name */
- msg = (struct nl_msg *)nlmsg_build(&req);
- /* Add genetlink header */
- genlh.cmd = CTRL_CMD_GETFAMILY;
- genlh.version = 0x1;
- nlmsg_append(msg, &genlh, GENL_HDRLEN, 0);
- /* Add attributes */
- ret = nla_put_string(msg, CTRL_ATTR_FAMILY_NAME, TASKSTATS_GENL_NAME);
- if (ret < 0)
- goto err;
- nl_send_auto_complete(nlh, nlmsg_hdr(msg));
-
- FD_ZERO(&nlhs);
- sd = nl_handle_get_fd(nlh);
- tv.tv_sec = 5;
- tv.tv_usec = 0;
- FD_SET(sd, &nlhs);
- ret = select(sd + 1, &nlhs, 0, 0, &tv);
- if (ret < 0)
- err(1, "no response from netlink in 5 seconds\n");
- /* go ahead and receive select returns >= 0 */
- n = nl_recv(nlh, &peer, &rmsg);
- rep = (struct nlmsghdr *)rmsg;
- while (nlmsg_ok(rep, n)) {
- nla = nlmsg_attrdata(rep, GENL_HDRLEN);
- len = nlmsg_attrlen(rep, GENL_HDRLEN);
- if (nla_ok(nla, len)) {
- nla = nla_find(nla, len, CTRL_ATTR_FAMILY_ID);
- if (nla) {
- id = nla_get_u16(nla);
- goto done;
- }
- }
- rep = nlmsg_next(rep, &n);
- }
-done:
- free(rmsg);
- nlmsg_free(msg);
- return id;
-err:
- return -1;
-}
-
-/*
- * Get statistics for the specified pid/tgid
- */
-static int get_stats(struct nl_handle *nlh, int tid, int cmd_type, int forking,
- int family_id)
-{
- struct nlmsghdr req;
- struct nlmsghdr *rep;
- struct genlmsghdr genlh;
- struct nl_msg *msg = NULL;
- fd_set nlhs;
- int sd;
- int ret = 0;
- struct timeval tv;
- struct sockaddr_nl peer;
- unsigned char *rmsg;
- int n;
- struct nlattr *nla, *nnla; /* netlink and nested netlink */
- int len;
- int rtid;
- char cpumask[100+6*MAX_CPUS];
-
- snprintf(cpumask, sizeof(cpumask) - 1, "0-%d", get_nprocs() - 1);
- /*
- * Send out the cpumask
- */
- req.nlmsg_type = family_id;
- req.nlmsg_pid = tid;
- msg = (struct nl_msg *)nlmsg_build(&req);
- genlh.cmd = TASKSTATS_CMD_GET;
- genlh.version = TASKSTATS_VERSION;
- nlmsg_append(msg, &genlh, GENL_HDRLEN, 0);
- /* Add attributes */
- ret = nla_put_string(msg, TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, cpumask);
- if (ret < 0)
- goto serr;
- nl_send_auto_complete(nlh, nlmsg_hdr(msg));
- if (nl_wait_for_ack(nlh) < 0)
- goto serr;
- nlmsg_free(msg);
- /*
- * If we are forking, we will wait for the child to die
- */
- if (!forking) {
- req.nlmsg_type = family_id;
- req.nlmsg_pid = tid;
- msg = (struct nl_msg *)nlmsg_build(&req);
- /* Add genetlink header */
- genlh.cmd = TASKSTATS_CMD_GET;
- genlh.version = TASKSTATS_VERSION;
- nlmsg_append(msg, &genlh, GENL_HDRLEN, 0);
- /* Add attributes */
- ret = nla_put_u32(msg, cmd_type, tid);
- if (ret < 0)
- goto serr;
- nl_send_auto_complete(nlh, nlmsg_hdr(msg));
- if (nl_wait_for_ack(nlh) < 0)
- goto serr;
- }
-
- FD_ZERO(&nlhs);
- sd = nl_handle_get_fd(nlh);
- tv.tv_sec = 5;
- tv.tv_usec = 0;
- FD_SET(sd, &nlhs);
-
- do {
- ret = select(sd + 1, &nlhs, 0, 0, &tv);
- if (ret < 0)
- err(1, "no response from netlink in 5 seconds\n");
-
- /* go ahead and receive select returns >= 0 */
- n = nl_recv(nlh, &peer, &rmsg);
- rep = (struct nlmsghdr *)rmsg;
-
- while (nlmsg_ok(rep, n)) {
- nla = nlmsg_attrdata(rep, GENL_HDRLEN);
- len = nlmsg_attrlen(rep, GENL_HDRLEN);
- if (nla_ok(nla, len)) {
- nnla = nla_find(nla, len,
- TASKSTATS_TYPE_AGGR_TGID);
- if (!nnla)
- nnla = nla_find(nla, len,
- TASKSTATS_TYPE_AGGR_PID);
-
- /* It is a nested attribute, move down */
- if (nnla) {
- nnla = nla_data(nnla);
- rtid = nla_get_u32(nnla);
- if (rtid == tid) {
- nnla =
- nla_find(nnla, len,
- TASKSTATS_TYPE_STATS);
- print_taskstats((struct
- taskstats *)
- nla_data(nnla));
- goto sdone;
- }
- }
- } else {
- break;
- }
- rep = nlmsg_next(rep, &n);
- }
- } while (forking && !done);
-sdone:
- free(rmsg);
- if (!forking)
- nlmsg_free(msg);
- return ret;
-serr:
- return -1;
-}
-
-void sigchld(int sig)
+void print_ioacct(struct taskstats *t)
{
- done = 1;
+ printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n",
+ t->ac_comm,
+ (unsigned long long)t->read_bytes,
+ (unsigned long long)t->write_bytes,
+ (unsigned long long)t->cancelled_write_bytes);
}
int main(int argc, char *argv[])
{
- int rc = 0;
- struct nl_handle *nlh;
+ int c, rc, rep_len, aggr_len, len2, cmd_type;
__u16 id;
+ __u32 mypid;
+ struct nlattr *na;
+ int nl_sd = -1;
+ int len = 0;
pid_t tid = 0;
- int cmd_type = TASKSTATS_TYPE_TGID;
- int c;
- int forking = 0;
-
- struct sigaction act;
- struct sigaction chld_act;
-
- act.sa_handler = SIG_IGN;
- sigemptyset(&act.sa_mask);
-
- chld_act.sa_handler = sigchld;
- sigemptyset(&chld_act.sa_mask);
-
- if (argc < 3) {
- printf("usage %s [-t tgid][-p pid][-c cmd]\n", argv[0]);
- exit(-1);
- }
+ pid_t rtid = 0;
- if (sigaction(SIGCHLD, &chld_act, NULL) < 0)
- err(1, "sigaction failed for SIGCHLD\n");
+ int fd = 0;
+ int count = 0;
+ int write_file = 0;
+ int maskset = 0;
+ char *logfile = NULL;
+ int loop = 0;
- while (1) {
+ struct msgtemplate msg;
- c = getopt(argc, argv, "t:p:c:");
+ while (1) {
+ c = getopt(argc, argv, "diw:r:m:t:p:vl");
if (c < 0)
break;
switch (c) {
+ case 'd':
+ printf("print delayacct stats ON\n");
+ print_delays = 1;
+ break;
+ case 'i':
+ printf("printing IO accounting\n");
+ print_io_accounting = 1;
+ break;
+ case 'w':
+ logfile = strdup(optarg);
+ printf("write to file %s\n", logfile);
+ write_file = 1;
+ break;
+ case 'r':
+ rcvbufsz = atoi(optarg);
+ printf("receive buf size %d\n", rcvbufsz);
+ if (rcvbufsz < 0)
+ err(1, "Invalid rcv buf size\n");
+ break;
+ case 'm':
+ strncpy(cpumask, optarg, sizeof(cpumask));
+ maskset = 1;
+ printf("cpumask %s maskset %d\n", cpumask, maskset);
+ break;
case 't':
tid = atoi(optarg);
if (!tid)
@@ -310,41 +290,160 @@
tid = atoi(optarg);
if (!tid)
err(1, "Invalid pid\n");
- cmd_type = TASKSTATS_CMD_ATTR_TGID;
+ cmd_type = TASKSTATS_CMD_ATTR_PID;
break;
- case 'c':
- opterr = 0;
- tid = fork();
- if (tid < 0)
- err(1, "fork failed\n");
-
- /*
- * NOTE: some synchronization b/w parent & child might
- * be required here
- */
- if (tid == 0) { /* child process */
- if (execvp(argv[optind - 1], &argv[optind - 1])
- < 0) {
- err(1, "command %s not found\n",
- argv[optind - 1]);
- }
- }
- forking = 1;
+ case 'v':
+ printf("debug on\n");
+ dbg = 1;
break;
- default:
- case '?':
- //printf("usage %s [-t tgid][-p pid][-c cmd]\n", argv[0]);
- //exit(-1);
+ case 'l':
+ printf("listen forever\n");
+ loop = 1;
break;
+ default:
+ usage();
+ exit(-1);
}
- if (c == 'c')
- break;
}
- nlh = create_nl_socket();
- id = get_family_id(nlh);
- rc = get_stats(nlh, tid, cmd_type, forking, id);
- nl_close(nlh);
- nl_handle_destroy(nlh);
- return rc;
+ if (write_file) {
+ fd = open(logfile, O_WRONLY | O_CREAT | O_TRUNC,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ if (fd == -1) {
+ perror("Cannot open output file\n");
+ exit(1);
+ }
+ }
+
+ if ((nl_sd = create_nl_socket(NETLINK_GENERIC)) < 0)
+ err(1, "error creating Netlink socket\n");
+
+
+ mypid = getpid();
+ id = get_family_id(nl_sd);
+ if (!id) {
+ fprintf(stderr, "Error getting family id, errno %d\n", errno);
+ goto err;
+ }
+ PRINTF("family id %d\n", id);
+
+ if (maskset) {
+ rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
+ TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
+ &cpumask, strlen(cpumask) + 1);
+ PRINTF("Sent register cpumask, retval %d\n", rc);
+ if (rc < 0) {
+ fprintf(stderr, "error sending register cpumask\n");
+ goto err;
+ }
+ }
+
+ if (tid) {
+ rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
+ cmd_type, &tid, sizeof(__u32));
+ PRINTF("Sent pid/tgid, retval %d\n", rc);
+ if (rc < 0) {
+ fprintf(stderr, "error sending tid/tgid cmd\n");
+ goto done;
+ }
+ }
+
+ do {
+ int i;
+
+ rep_len = recv(nl_sd, &msg, sizeof(msg), 0);
+ PRINTF("received %d bytes\n", rep_len);
+
+ if (rep_len < 0) {
+ fprintf(stderr, "nonfatal reply error: errno %d\n",
+ errno);
+ continue;
+ }
+ if (msg.n.nlmsg_type == NLMSG_ERROR ||
+ !NLMSG_OK((&msg.n), rep_len)) {
+ struct nlmsgerr *err = NLMSG_DATA(&msg);
+ fprintf(stderr, "fatal reply error, errno %d\n",
+ err->error);
+ goto done;
+ }
+
+ PRINTF("nlmsghdr size=%d, nlmsg_len=%d, rep_len=%d\n",
+ sizeof(struct nlmsghdr), msg.n.nlmsg_len, rep_len);
+
+
+ rep_len = GENLMSG_PAYLOAD(&msg.n);
+
+ na = (struct nlattr *) GENLMSG_DATA(&msg);
+ len = 0;
+ i = 0;
+ while (len < rep_len) {
+ len += NLA_ALIGN(na->nla_len);
+ switch (na->nla_type) {
+ case TASKSTATS_TYPE_AGGR_TGID:
+ /* Fall through */
+ case TASKSTATS_TYPE_AGGR_PID:
+ aggr_len = NLA_PAYLOAD(na->nla_len);
+ len2 = 0;
+ /* For nested attributes, na follows */
+ na = (struct nlattr *) NLA_DATA(na);
+ done = 0;
+ while (len2 < aggr_len) {
+ switch (na->nla_type) {
+ case TASKSTATS_TYPE_PID:
+ rtid = *(int *) NLA_DATA(na);
+ if (print_delays)
+ printf("PID\t%d\n", rtid);
+ break;
+ case TASKSTATS_TYPE_TGID:
+ rtid = *(int *) NLA_DATA(na);
+ if (print_delays)
+ printf("TGID\t%d\n", rtid);
+ break;
+ case TASKSTATS_TYPE_STATS:
+ count++;
+ if (print_delays)
+ print_delayacct((struct taskstats *) NLA_DATA(na));
+ if (print_io_accounting)
+ print_ioacct((struct taskstats *) NLA_DATA(na));
+ if (fd) {
+ if (write(fd, NLA_DATA(na), na->nla_len) < 0) {
+ err(1,"write error\n");
+ }
+ }
+ if (!loop)
+ goto done;
+ break;
+ default:
+ fprintf(stderr, "Unknown nested"
+ " nla_type %d\n",
+ na->nla_type);
+ break;
+ }
+ len2 += NLA_ALIGN(na->nla_len);
+ na = (struct nlattr *) ((char *) na + len2);
+ }
+ break;
+
+ default:
+ fprintf(stderr, "Unknown nla_type %d\n",
+ na->nla_type);
+ break;
+ }
+ na = (struct nlattr *) (GENLMSG_DATA(&msg) + len);
+ }
+ } while (loop);
+done:
+ if (maskset) {
+ rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
+ TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
+ &cpumask, strlen(cpumask) + 1);
+ printf("Sent deregister mask, retval %d\n", rc);
+ if (rc < 0)
+ err(rc, "error sending deregister cpumask\n");
+ }
+err:
+ close(nl_sd);
+ if (fd)
+ close(fd);
+ return 0;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/delayacct-utils-0.2/linux/taskstats.h new/delayacct-utils-0.3/linux/taskstats.h
--- old/delayacct-utils-0.2/linux/taskstats.h 2007-01-05 13:49:47.000000000 +0100
+++ new/delayacct-utils-0.3/linux/taskstats.h 2007-08-22 15:06:31.000000000 +0200
@@ -31,7 +31,7 @@
*/
-#define TASKSTATS_VERSION 2
+#define TASKSTATS_VERSION 4
#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
* in linux/sched.h */
@@ -66,7 +66,7 @@
/* Delay waiting for cpu, while runnable
* count, delay_total NOT updated atomically
*/
- __u64 cpu_count;
+ __u64 cpu_count __attribute__((aligned(8)));
__u64 cpu_delay_total;
/* Following four fields atomically updated using task->delays->lock */
@@ -101,45 +101,54 @@
/* Basic Accounting Fields start */
char ac_comm[TS_COMM_LEN]; /* Command name */
- __u8 ac_sched; /* Scheduling discipline */
+ __u8 ac_sched __attribute__((aligned(8)));
+ /* Scheduling discipline */
__u8 ac_pad[3];
- __u32 ac_uid; /* User ID */
+ __u32 ac_uid __attribute__((aligned(8)));
+ /* User ID */
__u32 ac_gid; /* Group ID */
__u32 ac_pid; /* Process ID */
__u32 ac_ppid; /* Parent process ID */
__u32 ac_btime; /* Begin time [sec since 1970] */
- __u64 ac_etime; /* Elapsed time [usec] */
+ __u64 ac_etime __attribute__((aligned(8)));
+ /* Elapsed time [usec] */
__u64 ac_utime; /* User CPU time [usec] */
__u64 ac_stime; /* SYstem CPU time [usec] */
__u64 ac_minflt; /* Minor Page Fault Count */
__u64 ac_majflt; /* Major Page Fault Count */
/* Basic Accounting Fields end */
- /* Extended accounting fields start */
+ /* Extended accounting fields start */
/* Accumulated RSS usage in duration of a task, in MBytes-usecs.
* The current rss usage is added to this counter every time
* a tick is charged to a task's system time. So, at the end we
* will have memory usage multiplied by system time. Thus an
* average usage per system time unit can be calculated.
*/
- __u64 coremem; /* accumulated RSS usage in MB-usec */
+ __u64 coremem; /* accumulated RSS usage in MB-usec */
/* Accumulated virtual memory usage in duration of a task.
* Same as acct_rss_mem1 above except that we keep track of VM usage.
*/
- __u64 virtmem; /* accumulated VM usage in MB-usec */
+ __u64 virtmem; /* accumulated VM usage in MB-usec */
/* High watermark of RSS and virtual memory usage in duration of
* a task, in KBytes.
*/
- __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */
- __u64 hiwater_vm; /* High-water VM usage, in KB */
+ __u64 hiwater_rss; /* High-watermark of RSS usage, in KB */
+ __u64 hiwater_vm; /* High-water VM usage, in KB */
/* The following four fields are I/O statistics of a task. */
- __u64 read_char; /* bytes read */
- __u64 write_char; /* bytes written */
- __u64 read_syscalls; /* read syscalls */
- __u64 write_syscalls; /* write syscalls */
- /* Extended accounting fields end */
+ __u64 read_char; /* bytes read */
+ __u64 write_char; /* bytes written */
+ __u64 read_syscalls; /* read syscalls */
+ __u64 write_syscalls; /* write syscalls */
+ /* Extended accounting fields end */
+
+#define TASKSTATS_HAS_IO_ACCOUNTING
+ /* Per-task storage I/O accounting starts */
+ __u64 read_bytes; /* bytes of read I/O */
+ __u64 write_bytes; /* bytes of write I/O */
+ __u64 cancelled_write_bytes; /* bytes of cancelled write I/O */
};
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org