Hi! I''m a dtrace newbie. Is there a way to change the format of a timestamp? For example now I have this output with printf("%Y",timestamp): "2008 Nov 4 15:44:37" I would like to have this kind of output instead: "2008-11-4 15:44:37" How can I obtain it? Thanks! -- This message posted from opensolaris.org
Nope, sorry. Sounds like a good RFE for a -x option. Adam On Nov 4, 2008, at 6:55 AM, Davide Vanoni wrote:> Hi! I''m a dtrace newbie. Is there a way to change the format of a > timestamp? For example now I have this output with > printf("%Y",timestamp): > "2008 Nov 4 15:44:37" > I would like to have this kind of output instead: > "2008-11-4 15:44:37" > How can I obtain it? > Thanks! > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Hi, Is it possible to get know endianness on the solaris target by using dtrace? Best Regards, /Mitsu
> Is it possible to get know endianness on the solaris target by using > dtrace?My first suggestion would be to find a C preprocessor directive that''d tell you the answer. Lacking that, you could do something like: #!/usr/sbin/dtrace -Cs /* Look for little-endian archs and set appropriately. */ #ifdef i386 #define LITTLE_ENDIAN #endif ::ip_input:entry { #ifdef LITTLE_ENDIAN printf("Little!\n"); #else printf("Big!\n"); #endif exit(0); } Dan
On Tue, Nov 11, 2008 at 3:57 PM, Dan McDonald <danmcd at sun.com> wrote:>> Is it possible to get know endianness on the solaris target by using >> dtrace? > > My first suggestion would be to find a C preprocessor directive that''d tell > you the answer. Lacking that, you could do something like: > > #!/usr/sbin/dtrace -Cs > > /* Look for little-endian archs and set appropriately. */ > #ifdef i386 > #define LITTLE_ENDIAN > #endif > > ::ip_input:entry > { > #ifdef LITTLE_ENDIAN > printf("Little!\n"); > #else > printf("Big!\n"); > #endif > exit(0); > } > > DanDan, How about #include <sys/isa_defs.h> instead of> #ifdef i386 > #define LITTLE_ENDIAN > #endifwhich gives you _LITTLE_ENDIAN and _BIG_ENDIAN ? -- Regards, Cyril
Hi Dan, Thanks for your suggestion! I am not frequent user of dtrace. So I can rely on the C preprocessor and perform like C program. And I wonder if there is any solaris command to get such information. Thanks, /Mitsu -----Original Message----- From: Dan McDonald [mailto:danmcd at sun.com] Sent: den 11 november 2008 14:57 To: Mitsuhiro Nakamura Cc: dtrace-discuss at opensolaris.org Subject: Re: [dtrace-discuss] endianness> Is it possible to get know endianness on the solaris target by using > dtrace?My first suggestion would be to find a C preprocessor directive that''d tell you the answer. Lacking that, you could do something like: #!/usr/sbin/dtrace -Cs /* Look for little-endian archs and set appropriately. */ #ifdef i386 #define LITTLE_ENDIAN #endif ::ip_input:entry { #ifdef LITTLE_ENDIAN printf("Little!\n"); #else printf("Big!\n"); #endif exit(0); } Dan
On Tue, Nov 11, 2008 at 03:46:08PM +0100, Mitsuhiro Nakamura wrote:> Hi Dan,> Thanks for your suggestion!Thank Cyril too -- he found the explicit preprocessor directives I was seeking.> I am not frequent user of dtrace. So I can rely on the C preprocessor and > perform like C program.If you specify -C either in your script''s header or in the dtrace(1M) invocation itself.> And I wonder if there is any solaris command to get such information.Hmmm. That''s a good question. I''m not aware of a quick-and-dirty command that returns the endian value, but it should be simple enough to write one. Dan