Print this page
Add perl support KSTAT_DATA_TIME.

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs
          +++ new/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs
↓ 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 (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2014 Racktop Systems.
       25 + * Copyright 2016 Garrett D'Amore
  25   26   */
  26   27  
  27   28  /*
  28   29   * Kstat.xs is a Perl XS (eXStension module) that makes the Solaris
  29   30   * kstat(3KSTAT) facility available to Perl scripts.  Kstat is a general-purpose
  30   31   * mechanism  for  providing kernel statistics to users.  The Solaris API is
  31   32   * function-based (see the manpage for details), but for ease of use in Perl
  32   33   * scripts this module presents the information as a nested hash data structure.
  33   34   * It would be too inefficient to read every kstat in the system, so this module
  34   35   * uses the Perl TIEHASH mechanism to implement a read-on-demand semantic, which
↓ open down ↓ 1032 lines elided ↑ open up ↑
1067 1068                          break;
1068 1069                  case KSTAT_DATA_UINT32:
1069 1070                          value = NEW_UV(knp->value.ui32);
1070 1071                          break;
1071 1072                  case KSTAT_DATA_INT64:
1072 1073                          value = NEW_UV(knp->value.i64);
1073 1074                          break;
1074 1075                  case KSTAT_DATA_UINT64:
1075 1076                          value = NEW_UV(knp->value.ui64);
1076 1077                          break;
     1078 +                case KSTAT_DATA_TIME:
     1079 +                        value = NEW_HRTIME(knp->value.ui64);
     1080 +                        break;
1077 1081                  case KSTAT_DATA_STRING:
1078 1082                          if (KSTAT_NAMED_STR_PTR(knp) == NULL)
1079 1083                                  value = newSVpv("null", sizeof ("null") - 1);
1080 1084                          else
1081 1085                                  value = newSVpv(KSTAT_NAMED_STR_PTR(knp),
1082 1086                                                  KSTAT_NAMED_STR_BUFLEN(knp) -1);
1083 1087                          break;
1084 1088                  default:
1085 1089                          PERL_ASSERTMSG(0, "kstat_read: invalid data type");
1086 1090                          continue;
↓ open down ↓ 603 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX