Print this page
3396 new psrinfo does not print socket type
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/psrinfo/psrinfo.c
          +++ new/usr/src/cmd/psrinfo/psrinfo.c
↓ open down ↓ 3 lines elided ↑ open up ↑
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13   13   * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
       14 + * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  14   15   */
  15   16  
  16   17  /*
  17   18   * This implements psrinfo(1M), a utility to report various information
  18   19   * about processors, cores, and threads (virtual cpus).  This is mostly
  19   20   * intended for human consumption - this utility doesn't do much more than
  20   21   * simply process kstats for human readability.
  21   22   *
  22   23   * All the relevant kstats are in the cpu_info kstat module.
  23   24   */
↓ open down ↓ 66 lines elided ↑ open up ↑
  90   91          struct core     *v_core;
  91   92  
  92   93          char            *v_state;
  93   94          long            v_state_begin;
  94   95          char            *v_cpu_type;
  95   96          char            *v_fpu_type;
  96   97          long            v_clock_mhz;
  97   98          long            v_pchip_id;     /* 1 per socket */
  98   99          char            *v_impl;
  99  100          char            *v_brand;
      101 +        char            *v_socket;
 100  102          long            v_core_id;      /* n per chip_id */
 101  103  };
 102  104  
 103  105  static struct link *pchips = NULL;
 104  106  static struct link *cores = NULL;
 105  107  static struct link *vcpus = NULL;
 106  108  
 107  109  static const char *cmdname;
 108  110  
 109  111  static void
↓ open down ↓ 151 lines elided ↑ open up ↑
 261  263                  print_links(chip->p_vcpus);
 262  264                  (void) putchar('\n');
 263  265  
 264  266                  if ((chip->p_ncore == 1) || (chip->p_ncore == chip->p_nvcpu)) {
 265  267                          if (strlen(vcpu->v_impl)) {
 266  268                                  (void) printf("  %s\n", vcpu->v_impl);
 267  269                          }
 268  270                          if (((len = strlen(vcpu->v_brand)) != 0) &&
 269  271                              (strncmp(vcpu->v_brand, vcpu->v_impl, len) != 0))
 270  272                                  (void) printf("\t%s", vcpu->v_brand);
      273 +                        if (strcmp(vcpu->v_socket, "Unknown") != 0)
      274 +                                (void) printf("\t[ %s: %s ]", _("Socket"),
      275 +                                    vcpu->v_socket);
 271  276                          (void) putchar('\n');
 272  277                  } else {
 273  278                          for (l2 = chip->p_cores; l2; l2 = l2->l_next) {
 274  279                                  core = l2->l_ptr;
 275  280                                  (void) printf(_("  %s has %d virtual %s"),
 276  281                                      _("The core"),
 277  282                                      core->c_nvcpu,
 278  283                                      chip->p_nvcpu > 1 ?
 279  284                                      _("processors") : _("processor"));
 280  285                                  print_links(core->c_vcpus);
↓ open down ↓ 219 lines elided ↑ open up ↑
 500  505                  if ((knp = kstat_data_lookup(ksp, "clock_MHz")) != NULL) {
 501  506                          vc->v_clock_mhz = knp->value.l;
 502  507                  }
 503  508  
 504  509                  if ((knp = kstat_data_lookup(ksp, "brand")) == NULL) {
 505  510                          vc->v_brand = _("(unknown)");
 506  511                  } else {
 507  512                          vc->v_brand = mystrdup(knp->value.str.addr.ptr);
 508  513                  }
 509  514  
      515 +                if ((knp = kstat_data_lookup(ksp, "socket_type")) == NULL) {
      516 +                        vc->v_socket = "Unknown";
      517 +                } else {
      518 +                        vc->v_socket = mystrdup(knp->value.str.addr.ptr);
      519 +                }
      520 +
 510  521                  if ((knp = kstat_data_lookup(ksp, "implementation")) == NULL) {
 511  522                          vc->v_impl = _("(unknown)");
 512  523                  } else {
 513  524                          vc->v_impl = mystrdup(knp->value.str.addr.ptr);
 514  525                  }
 515  526                  /*
 516  527                   * Legacy code removed the chipid and cpuid fields... we
 517  528                   * do the same for compatibility.  Note that the original
 518  529                   * pattern is a bit strange, and we have to emulate this because
 519  530                   * on SPARC we *do* emit these.  The original pattern we are
↓ open down ↓ 136 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX