* Re: [rft] testing BSD accounting format on different archs
@ 2004-05-14 1:48 Y.Ishikawa
2004-05-14 6:53 ` Tim Schmielau
0 siblings, 1 reply; 3+ messages in thread
From: Y.Ishikawa @ 2004-05-14 1:48 UTC (permalink / raw)
To: tim; +Cc: linux-kernel, y.ishikawa
[-- Attachment #1: Type: text/plain, Size: 2716 bytes --]
Hello,
>Date Sat, 24 Apr 2004 13:46:54 +0200 (CEST)
>From Tim Schmielau <>
>Subject [rft] testing BSD accounting format on different archs
>
>I intend to modify the format of the BSD accounting file in a way that
>
> a) allows cross-platform compatibility using patched acct tools and
> b) is fully binary compatible with the current format.
>
>To make sure these goals are met on all platforms, I'd like to see the
>output of the attached program on all linux ports *except* x86
>(I want to keep my Inbox manageable:).
Please see the attachment for details of the result of acct after applying
your patch.
My machine is:
2 SMP of Itanium 2 (1.2GHz)
Memory: 8 Gbytes
Kernel: 2.6.6
BTW. how is your development for "version2" that you posted in this Mar.19.
I have been interested in your V2 format. The account data is very
useful for performance analysis of processes. It would be more convenient
if acct datainclude pid and ppid.
Naturally I understood V2 would have some incompatibility against current
acct structure. However I'm sure the value of acct data would become larger
in V2.
I hope V2 structure would be included in 2.7 successfully.
I also found tgid is useful in multithread environment, especially NPTL, to
identify the thread and process of a work-unit. Could you add a tgid field
in your V2 structure?
Regards,
Y.Ishikawa
===< program message >================================================
ia64 ia64 ia64 GNU/Linux
v0 v1 v2
ac_flag 0 0 0
ac_version 1 1
ac_uid16 2 2 2
ac_gid16 4 4 4
ac_tty 6 6 6
ac_btime 8 8 8
ac_utime 12 12 12
ac_stime 14 14 14
ac_etime 16 16 16
ac_mem 18 18 18
ac_io 20 20 20
ac_rw 22 22 22
ac_minflt 24 24 24
ac_majflt 26 26 26
ac_swaps 28 28 28
ac_ahz 30 36
ac_exitcode 32 32 32
ac_comm 36 36 38
ac_etime_hi 53 55
ac_etime_lo 54 56
ac_uid 56 60
ac_gid 60 64
sizeof(struct acct)
64 64 68
01 00 04 03 06 05 08 07 0c 0b 0a 09 0e 0d 10 0f
12 11 14 13 16 15 18 17 1a 19 1c 1b 1e 1d 00 00
24 23 22 21 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30
31 32 33 34 35 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 00
01 02 04 03 06 05 08 07 0c 0b 0a 09 0e 0d 10 0f
12 11 14 13 16 15 18 17 1a 19 1c 1b 1e 1d 20 1f
24 23 22 21 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30
31 32 33 34 35 36 38 37 3c 3b 3a 39 40 3f 3e 3d
01 02 04 03 06 05 08 07 0c 0b 0a 09 0e 0d 10 0f
12 11 14 13 16 15 18 17 1a 19 1c 1b 1e 1d 00 00
24 23 22 21 20 1f 25 26 27 28 29 2a 2b 2c 2d 2e
2f 30 31 32 33 34 35 36 38 37 00 00 3c 3b 3a 39
[-- Attachment #2: acct_test_nQPpjh --]
[-- Type: application/octet-stream, Size: 192 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [rft] testing BSD accounting format on different archs
2004-05-14 1:48 [rft] testing BSD accounting format on different archs Y.Ishikawa
@ 2004-05-14 6:53 ` Tim Schmielau
0 siblings, 0 replies; 3+ messages in thread
From: Tim Schmielau @ 2004-05-14 6:53 UTC (permalink / raw)
To: Y.Ishikawa; +Cc: linux-kernel
On Fri, 14 May 2004, Y.Ishikawa wrote:
> Please see the attachment for details of the result of acct after applying
> your patch.
Thanks!
> BTW. how is your development for "version2" that you posted in this Mar.19.
> I have been interested in your V2 format. The account data is very
> useful for performance analysis of processes. It would be more convenient
> if acct datainclude pid and ppid.
> Naturally I understood V2 would have some incompatibility against current
> acct structure. However I'm sure the value of acct data would become larger
> in V2.
> I hope V2 structure would be included in 2.7 successfully.
> I also found tgid is useful in multithread environment, especially NPTL, to
> identify the thread and process of a work-unit. Could you add a tgid field
> in your V2 structure?
Unfortunaltely my day job consumes all my time until end of next week.
After that I want to hack on the GNU acct tools so they understand the new
formats. If that doesn't raise new problems, I'll submit a patch for 2.6.
Both v1 and v2 are intended to be binary compatible, v2 on m68k, v1 on
all other platforms (I'll probably reverse the version numbers, so that
only m68k user might get confused by thinking that v2 is "better" than
v1)
For 2.7, (and optional for 2,6), a new v3 format is planned with a
properly aligned layout, so that much of the compatibility cruft can go.
Since v1, v2 and v3 formats already use up all 64 bytes of struct acct,
there also has been interest in an optional 128 byte v4 format. This would
provide enough space to include tgid (further suggestions welcome).
This may sound like a plethora of new formats, but I think it provides a
smooth transition if just one new release of the acct tools is able to
read all of them.
sorry for the delay,
Tim
^ permalink raw reply [flat|nested] 3+ messages in thread
* [rft] testing BSD accounting format on different archs
@ 2004-04-24 11:46 Tim Schmielau
0 siblings, 0 replies; 3+ messages in thread
From: Tim Schmielau @ 2004-04-24 11:46 UTC (permalink / raw)
To: lkml
[-- Attachment #1: Type: TEXT/PLAIN, Size: 392 bytes --]
I intend to modify the format of the BSD accounting file in a way that
a) allows cross-platform compatibility using patched acct tools and
b) is fully binary compatible with the current format.
To make sure these goals are met on all platforms, I'd like to see the
output of the attached program on all linux ports *except* x86
(I want to keep my Inbox manageable:).
Thanks a lot,
Tim
[-- Attachment #2: Type: TEXT/plain, Size: 8146 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/types.h>
typedef __u16 comp_t;
#define ACCT_COMM 16
struct acct_v0
{
char ac_flag; /* Accounting Flags */
/*
* No binary format break with 2.0 - but when we hit 32bit uid we'll
* have to bite one
*/
__u16 ac_uid; /* Accounting Real User ID */
__u16 ac_gid; /* Accounting Real Group ID */
__u16 ac_tty; /* Accounting Control Terminal */
__u32 ac_btime; /* Accounting Process Creation Time */
comp_t ac_utime; /* Accounting User Time */
comp_t ac_stime; /* Accounting System Time */
comp_t ac_etime; /* Accounting Elapsed Time */
comp_t ac_mem; /* Accounting Average Memory Usage */
comp_t ac_io; /* Accounting Chars Transferred */
comp_t ac_rw; /* Accounting Blocks Read or Written */
comp_t ac_minflt; /* Accounting Minor Pagefaults */
comp_t ac_majflt; /* Accounting Major Pagefaults */
comp_t ac_swaps; /* Accounting Number of Swaps */
__u32 ac_exitcode; /* Accounting Exitcode */
char ac_comm[ACCT_COMM + 1]; /* Accounting Command Name */
char ac_pad[10]; /* Accounting Padding Bytes */
};
struct acct_v1
{
char ac_flag; /* Flags */
char ac_version; /* Always set to ACCT_VERSION */
/* for binary compatibility back until 2.0 */
__u16 ac_uid16; /* LSB of Real User ID */
__u16 ac_gid16; /* LSB of Real Group ID */
__u16 ac_tty; /* Control Terminal */
__u32 ac_btime; /* Process Creation Time */
comp_t ac_utime; /* User Time */
comp_t ac_stime; /* System Time */
comp_t ac_etime; /* Elapsed Time */
comp_t ac_mem; /* Average Memory Usage */
comp_t ac_io; /* Chars Transferred */
comp_t ac_rw; /* Blocks Read or Written */
comp_t ac_minflt; /* Minor Pagefaults */
comp_t ac_majflt; /* Major Pagefaults */
comp_t ac_swaps; /* Number of Swaps */
/*
* We still need to identify the platforms that used to have no padding
* before ac_exitcode
*/
__u16 ac_ahz; /* AHZ */
__u32 ac_exitcode; /* Exitcode */
char ac_comm[ACCT_COMM + 1]; /* Command Name */
__u8 ac_etime_hi; /* Elapsed Time MSB */
__u16 ac_etime_lo; /* Elapsed Time LSB */
__u32 ac_uid; /* Real User ID */
__u32 ac_gid; /* Real Group ID */
};
struct acct_v2
{
char ac_flag; /* Flags */
char ac_version; /* Always set to ACCT_VERSION */
/* for binary compatibility back until 2.0 */
__u16 ac_uid16; /* LSB of Real User ID */
__u16 ac_gid16; /* LSB of Real Group ID */
__u16 ac_tty; /* Control Terminal */
__u32 ac_btime; /* Process Creation Time */
comp_t ac_utime; /* User Time */
comp_t ac_stime; /* System Time */
comp_t ac_etime; /* Elapsed Time */
comp_t ac_mem; /* Average Memory Usage */
comp_t ac_io; /* Chars Transferred */
comp_t ac_rw; /* Blocks Read or Written */
comp_t ac_minflt; /* Minor Pagefaults */
comp_t ac_majflt; /* Major Pagefaults */
comp_t ac_swaps; /* Number of Swaps */
/*
* We still need to identify the platforms that used to have no padding
* before ac_exitcode
*/
__u32 ac_exitcode; /* Exitcode */
__u16 ac_ahz; /* AHZ */
char ac_comm[ACCT_COMM + 1]; /* Command Name */
__u8 ac_etime_hi; /* Elapsed Time MSB */
__u16 ac_etime_lo; /* Elapsed Time LSB */
__u32 ac_uid; /* Real User ID */
__u32 ac_gid; /* Real Group ID */
};
struct acct_v0 ac_v0;
struct acct_v1 ac_v1;
struct acct_v2 ac_v2;
#define of(base,member) (int)((void *)&(base.member)-(void *)&base)
#define offsets2(member) of(ac_v1,member),of(ac_v2,member)
#define offsets3(member) of(ac_v0,member),of(ac_v1,member),of(ac_v2,member)
#define offsets12(member0,member1) of(ac_v0,member0),of(ac_v1,member1),of(ac_v2,member1)
char filename[] = "acct_test_XXXXXX";
int main(void)
{
int i, fd;
unsigned char buf[16];
system("uname -m -p -i -o");
printf("\n"
" v0 v1 v2\n"
"ac_flag %3d %3d %3d\n"
"ac_version %3d %3d\n"
"ac_uid16 %3d %3d %3d\n"
"ac_gid16 %3d %3d %3d\n"
"ac_tty %3d %3d %3d\n"
"ac_btime %3d %3d %3d\n"
"ac_utime %3d %3d %3d\n"
"ac_stime %3d %3d %3d\n"
"ac_etime %3d %3d %3d\n"
"ac_mem %3d %3d %3d\n"
"ac_io %3d %3d %3d\n"
"ac_rw %3d %3d %3d\n"
"ac_minflt %3d %3d %3d\n"
"ac_majflt %3d %3d %3d\n"
"ac_swaps %3d %3d %3d\n"
"ac_ahz %3d %3d\n"
"ac_exitcode %3d %3d %3d\n"
"ac_comm %3d %3d %3d\n"
"ac_etime_hi %3d %3d\n"
"ac_etime_lo %3d %3d\n"
"ac_uid %3d %3d\n"
"ac_gid %3d %3d\n"
"sizeof(struct acct)\n"
" %3d %3d %3d\n\n",
offsets3(ac_flag),
offsets2(ac_version),
offsets12(ac_uid,ac_uid16),
offsets12(ac_gid,ac_gid16),
offsets3(ac_tty),
offsets3(ac_btime),
offsets3(ac_utime),
offsets3(ac_stime),
offsets3(ac_etime),
offsets3(ac_mem),
offsets3(ac_io),
offsets3(ac_rw),
offsets3(ac_minflt),
offsets3(ac_majflt),
offsets3(ac_swaps),
offsets2(ac_ahz),
offsets3(ac_exitcode),
offsets3(ac_comm),
offsets2(ac_etime_hi),
offsets2(ac_etime_lo),
offsets2(ac_uid),
offsets2(ac_gid),
(int)sizeof(ac_v0), (int)sizeof(ac_v1), (int)sizeof(ac_v2)
);
ac_v0.ac_flag = 0x01;
ac_v0.ac_uid = 0x0304;
ac_v0.ac_gid = 0x0506;
ac_v0.ac_tty = 0x0708;
ac_v0.ac_btime = 0x090a0b0c;
ac_v0.ac_utime = 0x0d0e;
ac_v0.ac_stime = 0x0f10;
ac_v0.ac_etime = 0x1112;
ac_v0.ac_mem = 0x1314;
ac_v0.ac_io = 0x1516;
ac_v0.ac_rw = 0x1718;
ac_v0.ac_minflt = 0x191a;
ac_v0.ac_majflt = 0x1b1c;
ac_v0.ac_swaps = 0x1d1e;
ac_v0.ac_exitcode = 0x21222324;
for (i=0; i<17; i++)
ac_v0.ac_comm[i] = 0x25+i;
for (i=0; i<10; i++)
ac_v0.ac_pad[i] = 0xf0+i;
ac_v1.ac_flag = ac_v2.ac_flag = 0x01;
ac_v1.ac_version = ac_v2.ac_version = 0x02;
ac_v1.ac_uid16 = ac_v2.ac_uid16 = 0x0304;
ac_v1.ac_gid16 = ac_v2.ac_gid16 = 0x0506;
ac_v1.ac_tty = ac_v2.ac_tty = 0x0708;
ac_v1.ac_btime = ac_v2.ac_btime = 0x090a0b0c;
ac_v1.ac_utime = ac_v2.ac_utime = 0x0d0e;
ac_v1.ac_stime = ac_v2.ac_stime = 0x0f10;
ac_v1.ac_etime = ac_v2.ac_etime = 0x1112;
ac_v1.ac_mem = ac_v2.ac_mem = 0x1314;
ac_v1.ac_io = ac_v2.ac_io = 0x1516;
ac_v1.ac_rw = ac_v2.ac_rw = 0x1718;
ac_v1.ac_minflt = ac_v2.ac_minflt = 0x191a;
ac_v1.ac_majflt = ac_v2.ac_majflt = 0x1b1c;
ac_v1.ac_swaps = ac_v2.ac_swaps = 0x1d1e;
ac_v1.ac_ahz = ac_v2.ac_ahz = 0x1f20;
ac_v1.ac_exitcode = ac_v2.ac_exitcode = 0x21222324;
for (i=0; i<17; i++)
ac_v1.ac_comm[i] = ac_v2.ac_comm[i] = 0x25+i;
ac_v1.ac_etime_hi = ac_v2.ac_etime_hi = 0x36;
ac_v1.ac_etime_lo = ac_v2.ac_etime_lo = 0x3738;
ac_v1.ac_uid = ac_v2.ac_uid = 0x393a3b3c;
ac_v1.ac_gid = ac_v2.ac_gid = 0x3d3e3f40;
fd = mkstemp(filename);
if (write(fd, &ac_v0, 64) != 64) {
perror("write ac_v0");
return 1;
}
if (write(fd, &ac_v1, 64) != 64) {
perror("write ac_v1");
return 1;
}
if (write(fd, &ac_v2, 64) < 64) {
perror("write ac_v2");
return 1;
}
if (lseek(fd, 0, SEEK_SET)!=0) {
perror("seek");
return 1;
}
for (i=0; i<12; i++) {
if (read(fd, buf, 16) != 16) {
perror("read");
return 1;
}
printf(" %02x %02x %02x %02x %02x %02x %02x %02x"
" %02x %02x %02x %02x %02x %02x %02x %02x\n",
buf[0x00], buf[0x01], buf[0x02], buf[0x03],
buf[0x04], buf[0x05], buf[0x06], buf[0x07],
buf[0x08], buf[0x09], buf[0x0a], buf[0x0b],
buf[0x0c], buf[0x0d], buf[0x0e], buf[0x0f]
);
if ((i&3) == 3)
printf("\n");
}
close(fd);
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-14 6:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-14 1:48 [rft] testing BSD accounting format on different archs Y.Ishikawa
2004-05-14 6:53 ` Tim Schmielau
-- strict thread matches above, loose matches on Subject: below --
2004-04-24 11:46 Tim Schmielau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®