1#!/usr/bin/ksh
2/*
3 * test.ksh - DTrace include file test script.
4 *
5 * $Id: test.ksh 36 2007-09-15 06:51:18Z brendan $
6 *
7 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
8 *
9 * CDDL HEADER START
10 *
11 *  The contents of this file are subject to the terms of the
12 *  Common Development and Distribution License, Version 1.0 only
13 *  (the "License").  You may not use this file except in compliance
14 *  with the License.
15 *
16 *  You can obtain a copy of the license at Docs/cddl1.txt
17 *  or http://www.opensolaris.org/os/licensing.
18 *  See the License for the specific language governing permissions
19 *  and limitations under the License.
20 *
21 * CDDL HEADER END
22 *
23 * 16-Sep-2007	Brendan Gregg	Created this.
24 */
25
26dtrace -CI . -s /dev/stdin << END
27
28#include "tostr.h"
29#include "time.h"
30
31#pragma D option quiet
32#pragma D option destructive
33
34dtrace:::BEGIN
35{
36	i = 1;
37	printf("\nNUM_TO_STR   %12d = %s\n", i, NUM_TO_STR(i));
38	i = 1100;
39	printf("NUM_TO_STR   %12d = %s\n", i, NUM_TO_STR(i));
40	i = 1100000;
41	printf("NUM_TO_STR   %12d = %s\n", i, NUM_TO_STR(i));
42	i = 999999999;
43	printf("NUM_TO_STR   %12d = %s\n", i, NUM_TO_STR(i));
44
45	i = 1;
46	printf("\nBYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
47	i = 1024;
48	printf("BYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
49	i = 1000000;
50	printf("BYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
51	i = 999999999;
52	printf("BYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
53
54	i = 1;
55	printf("\nUS_TO_STR    %12d = %s\n", i, US_TO_STR(i));
56	i = 1100;
57	printf("US_TO_STR    %12d = %s\n", i, US_TO_STR(i));
58	i = 999999;
59	printf("US_TO_STR    %12d = %s\n", i, US_TO_STR(i));
60
61	printf("\nwalltimestamp : %Y\n", walltimestamp);
62	printf("TZ=GMT date   : ");
63	system("TZ=GMT date '+%%H:%%M:%%S'");
64	printf("TIME_HHMMSS   : %s\n", TIME_HHMMSS);
65
66	exit(0);
67}
68END
69