Print this page
Add boot_hrtime to global and zone kstats.
*** 20,29 ****
--- 20,30 ----
*/
/*
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014, Joyent, Inc. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 Garrett D'Amore
*/
/*
* Kernel statistics framework
*/
*** 146,155 ****
--- 147,157 ----
extern uint_t pollstats_ndata;
extern int vac;
extern uint_t nproc;
extern time_t boot_time;
+ extern hrtime_t boot_hrtime;
extern sysinfo_t sysinfo;
extern vminfo_t vminfo;
struct {
kstat_named_t ncpus;
*** 160,169 ****
--- 162,172 ----
kstat_named_t nproc;
kstat_named_t avenrun_1min;
kstat_named_t avenrun_5min;
kstat_named_t avenrun_15min;
kstat_named_t boot_time;
+ kstat_named_t boot_hrtime;
kstat_named_t nsec_per_tick;
} system_misc_kstat = {
{ "ncpus", KSTAT_DATA_UINT32 },
{ "lbolt", KSTAT_DATA_UINT32 },
{ "deficit", KSTAT_DATA_UINT32 },
*** 172,181 ****
--- 175,185 ----
{ "nproc", KSTAT_DATA_UINT32 },
{ "avenrun_1min", KSTAT_DATA_UINT32 },
{ "avenrun_5min", KSTAT_DATA_UINT32 },
{ "avenrun_15min", KSTAT_DATA_UINT32 },
{ "boot_time", KSTAT_DATA_UINT32 },
+ { "boot_hrtime", KSTAT_DATA_TIME },
{ "nsec_per_tick", KSTAT_DATA_UINT32 },
};
struct {
kstat_named_t physmem;
*** 808,817 ****
--- 812,822 ----
system_misc_kstat_update(kstat_t *ksp, int rw)
{
int myncpus = ncpus;
int *loadavgp = &avenrun[0];
time_t zone_boot_time;
+ hrtime_t zone_boot_hrtime;
clock_t zone_lbolt;
hrtime_t zone_hrtime;
size_t zone_nproc;
if (rw == KSTAT_WRITE)
*** 834,845 ****
--- 839,852 ----
if (INGLOBALZONE(curproc)) {
zone_boot_time = boot_time;
zone_lbolt = ddi_get_lbolt();
zone_nproc = nproc;
+ zone_boot_hrtime = boot_hrtime;
} else {
zone_boot_time = curproc->p_zone->zone_boot_time;
+ zone_boot_hrtime = curproc->p_zone->zone_boot_hrtime;
zone_hrtime = gethrtime();
zone_lbolt = (clock_t)(NSEC_TO_TICK(zone_hrtime) -
NSEC_TO_TICK(curproc->p_zone->zone_zsched->p_mstart));
mutex_enter(&curproc->p_zone->zone_nlwps_lock);
*** 856,865 ****
--- 863,873 ----
system_misc_kstat.avenrun_1min.value.ui32 = (uint32_t)loadavgp[0];
system_misc_kstat.avenrun_5min.value.ui32 = (uint32_t)loadavgp[1];
system_misc_kstat.avenrun_15min.value.ui32 = (uint32_t)loadavgp[2];
system_misc_kstat.boot_time.value.ui32 = (uint32_t)
zone_boot_time;
+ system_misc_kstat.boot_hrtime.value.t = zone_boot_hrtime;
system_misc_kstat.nsec_per_tick.value.ui32 = (uint32_t)
nsec_per_tick;
return (0);
}