PageRenderTime 26ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/books/DTraceToolkit-0.99/Include/test.ksh

https://bitbucket.org/kbw/wb-samples
Korn Shell | 68 lines | 55 code | 8 blank | 5 comment | 1 complexity | 0f470f5664564ec6686b3f7977c7abeb MD5 | raw file
Possible License(s): BSD-3-Clause, MPL-2.0-no-copyleft-exception
  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. dtrace -CI . -s /dev/stdin << END
  26. #include "tostr.h"
  27. #include "time.h"
  28. #pragma D option quiet
  29. #pragma D option destructive
  30. dtrace:::BEGIN
  31. {
  32. i = 1;
  33. printf("\nNUM_TO_STR %12d = %s\n", i, NUM_TO_STR(i));
  34. i = 1100;
  35. printf("NUM_TO_STR %12d = %s\n", i, NUM_TO_STR(i));
  36. i = 1100000;
  37. printf("NUM_TO_STR %12d = %s\n", i, NUM_TO_STR(i));
  38. i = 999999999;
  39. printf("NUM_TO_STR %12d = %s\n", i, NUM_TO_STR(i));
  40. i = 1;
  41. printf("\nBYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
  42. i = 1024;
  43. printf("BYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
  44. i = 1000000;
  45. printf("BYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
  46. i = 999999999;
  47. printf("BYTES_TO_STR %12d = %s\n", i, BYTES_TO_STR(i));
  48. i = 1;
  49. printf("\nUS_TO_STR %12d = %s\n", i, US_TO_STR(i));
  50. i = 1100;
  51. printf("US_TO_STR %12d = %s\n", i, US_TO_STR(i));
  52. i = 999999;
  53. printf("US_TO_STR %12d = %s\n", i, US_TO_STR(i));
  54. printf("\nwalltimestamp : %Y\n", walltimestamp);
  55. printf("TZ=GMT date : ");
  56. system("TZ=GMT date '+%%H:%%M:%%S'");
  57. printf("TIME_HHMMSS : %s\n", TIME_HHMMSS);
  58. exit(0);
  59. }
  60. END