Print this page
4740 kstat(1M) prints wrong snaptime

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/stat/kstat/kstat.c
          +++ new/usr/src/cmd/stat/kstat/kstat.c
↓ open down ↓ 649 lines elided ↑ open up ↑
 650  650                  (void) strlcpy(ksi->ks_name, kp->ks_name, KSTAT_STRLEN);
 651  651                  (void) strlcpy(ksi->ks_class, kp->ks_class, KSTAT_STRLEN);
 652  652  
 653  653                  ksi->ks_instance = kp->ks_instance;
 654  654                  ksi->ks_snaptime = kp->ks_snaptime;
 655  655                  ksi->ks_type = kp->ks_type;
 656  656  
 657  657                  list_create(&ksi->ks_nvlist, sizeof (ks_nvpair_t),
 658  658                      offsetof(ks_nvpair_t, nv_next));
 659  659  
 660      -                SAVE_HRTIME_X(ksi, "crtime", kp->ks_crtime);
 661      -                SAVE_HRTIME_X(ksi, "snaptime", kp->ks_snaptime);
 662      -                if (g_pflg) {
 663      -                        SAVE_STRING_X(ksi, "class", kp->ks_class);
 664      -                }
 665      -
 666  660                  /* Insert this instance into a sorted list */
 667  661                  tmp = list_head(&instances_list);
 668  662                  while (tmp != NULL && compare_instances(ksi, tmp) > 0)
 669  663                          tmp = list_next(&instances_list, tmp);
 670  664  
 671  665                  list_insert_before(&instances_list, tmp, ksi);
 672  666  
 673  667                  /* Read the actual statistics */
 674  668                  id = kstat_read(kc, kp, NULL);
 675  669                  if (id == -1) {
 676  670  #ifdef REPORT_UNKNOWN
 677  671                          perror("kstat_read");
 678  672  #endif
 679  673                          continue;
 680  674                  }
 681  675  
      676 +                SAVE_HRTIME_X(ksi, "crtime", kp->ks_crtime);
      677 +                SAVE_HRTIME_X(ksi, "snaptime", kp->ks_snaptime);
      678 +                if (g_pflg) {
      679 +                        SAVE_STRING_X(ksi, "class", kp->ks_class);
      680 +                }
      681 +
 682  682                  switch (kp->ks_type) {
 683  683                  case KSTAT_TYPE_RAW:
 684  684                          save_raw(kp, ksi);
 685  685                          break;
 686  686                  case KSTAT_TYPE_NAMED:
 687  687                          save_named(kp, ksi);
 688  688                          break;
 689  689                  case KSTAT_TYPE_INTR:
 690  690                          save_intr(kp, ksi);
 691  691                          break;
↓ open down ↓ 772 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX