Print this page
4477 DTrace should speak JSON
Reviewed by: Bryan Cantrill <bmc@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d
          +++ new/usr/src/cmd/dtrace/test/tst/common/aggs/tst.subr.d
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
  25   26   */
  26   27  
  27   28  #include <sys/dtrace.h>
  28   29  
  29   30  #define INTFUNC(x)                      \
  30   31          BEGIN                           \
  31   32          /*DSTYLED*/                     \
  32   33          {                               \
  33   34                  subr++;                 \
  34   35                  @[(long)x] = sum(1);    \
↓ open down ↓ 57 lines elided ↑ open up ↑
  92   93  INTFUNC(htonll(0x1234567890abcdefL))
  93   94  INTFUNC(ntohs(0x1234))
  94   95  INTFUNC(ntohl(0x12345678))
  95   96  INTFUNC(ntohll(0x1234567890abcdefL))
  96   97  STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t))))
  97   98  STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t))))
  98   99  STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t))))
  99  100  STRFUNC(toupper("foo"))
 100  101  STRFUNC(tolower("BAR"))
 101  102  INTFUNC(getf(0))
      103 +INTFUNC(strtoll("0x12EE5D5", 16))
      104 +STRFUNC(json("{\"systemtap\": false}", "systemtap"))
 102  105  
 103  106  BEGIN
 104  107  /subr == DIF_SUBR_MAX + 1/
 105  108  {
 106  109          exit(0);
 107  110  }
 108  111  
 109  112  BEGIN
 110  113  {
 111  114          printf("found %d subroutines, expected %d\n", subr, DIF_SUBR_MAX + 1);
 112  115          exit(1);
 113  116  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX