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

@@ -655,16 +655,10 @@
                 ksi->ks_type = kp->ks_type;
 
                 list_create(&ksi->ks_nvlist, sizeof (ks_nvpair_t),
                     offsetof(ks_nvpair_t, nv_next));
 
-                SAVE_HRTIME_X(ksi, "crtime", kp->ks_crtime);
-                SAVE_HRTIME_X(ksi, "snaptime", kp->ks_snaptime);
-                if (g_pflg) {
-                        SAVE_STRING_X(ksi, "class", kp->ks_class);
-                }
-
                 /* Insert this instance into a sorted list */
                 tmp = list_head(&instances_list);
                 while (tmp != NULL && compare_instances(ksi, tmp) > 0)
                         tmp = list_next(&instances_list, tmp);
 

@@ -677,10 +671,16 @@
                         perror("kstat_read");
 #endif
                         continue;
                 }
 
+                SAVE_HRTIME_X(ksi, "crtime", kp->ks_crtime);
+                SAVE_HRTIME_X(ksi, "snaptime", kp->ks_snaptime);
+                if (g_pflg) {
+                        SAVE_STRING_X(ksi, "class", kp->ks_class);
+                }
+
                 switch (kp->ks_type) {
                 case KSTAT_TYPE_RAW:
                         save_raw(kp, ksi);
                         break;
                 case KSTAT_TYPE_NAMED: