Print this page
Add boot_hrtime to global and zone kstats.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/zone.c
          +++ new/usr/src/uts/common/os/zone.c
↓ 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) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright 2013, Joyent Inc. All rights reserved.
       25 + * Copyright 2016 Garrett D'Amore
  25   26   */
  26   27  
  27   28  /*
  28   29   * Zones
  29   30   *
  30   31   *   A zone is a named collection of processes, namespace constraints,
  31   32   *   and other system resources which comprise a secure and manageable
  32   33   *   application containment facility.
  33   34   *
  34   35   *   Zones (represented by the reference counted zone_t) are tracked in
↓ open down ↓ 1795 lines elided ↑ open up ↑
1830 1831          tmp = zone->zone_utime;
1831 1832          scalehrtime(&tmp);
1832 1833          zmp->zm_utime.value.ui64 = tmp;
1833 1834          tmp = zone->zone_stime;
1834 1835          scalehrtime(&tmp);
1835 1836          zmp->zm_stime.value.ui64 = tmp;
1836 1837          tmp = zone->zone_wtime;
1837 1838          scalehrtime(&tmp);
1838 1839          zmp->zm_wtime.value.ui64 = tmp;
1839 1840  
     1841 +        zmp->zm_boot_hrtime.value.t = zone->zone_boot_hrtime;
     1842 +
1840 1843          zmp->zm_avenrun1.value.ui32 = zone->zone_avenrun[0];
1841 1844          zmp->zm_avenrun5.value.ui32 = zone->zone_avenrun[1];
1842 1845          zmp->zm_avenrun15.value.ui32 = zone->zone_avenrun[2];
1843 1846  
1844 1847          zmp->zm_ffcap.value.ui32 = zone->zone_ffcap;
1845 1848          zmp->zm_ffnoproc.value.ui32 = zone->zone_ffnoproc;
1846 1849          zmp->zm_ffnomem.value.ui32 = zone->zone_ffnomem;
1847 1850          zmp->zm_ffmisc.value.ui32 = zone->zone_ffmisc;
1848 1851  
1849 1852          return (0);
↓ open down ↓ 27 lines elided ↑ open up ↑
1877 1880          kstat_named_init(&zmp->zm_wtime, "nsec_waitrq", KSTAT_DATA_UINT64);
1878 1881          kstat_named_init(&zmp->zm_avenrun1, "avenrun_1min", KSTAT_DATA_UINT32);
1879 1882          kstat_named_init(&zmp->zm_avenrun5, "avenrun_5min", KSTAT_DATA_UINT32);
1880 1883          kstat_named_init(&zmp->zm_avenrun15, "avenrun_15min",
1881 1884              KSTAT_DATA_UINT32);
1882 1885          kstat_named_init(&zmp->zm_ffcap, "forkfail_cap", KSTAT_DATA_UINT32);
1883 1886          kstat_named_init(&zmp->zm_ffnoproc, "forkfail_noproc",
1884 1887              KSTAT_DATA_UINT32);
1885 1888          kstat_named_init(&zmp->zm_ffnomem, "forkfail_nomem", KSTAT_DATA_UINT32);
1886 1889          kstat_named_init(&zmp->zm_ffmisc, "forkfail_misc", KSTAT_DATA_UINT32);
     1890 +        kstat_named_init(&zmp->zm_boot_hrtime, "boot_hrtime", KSTAT_DATA_TIME);
1887 1891  
1888 1892  
1889 1893          ksp->ks_update = zone_misc_kstat_update;
1890 1894          ksp->ks_private = zone;
1891 1895  
1892 1896          kstat_install(ksp);
1893 1897          return (ksp);
1894 1898  }
1895 1899  
1896 1900  static void
↓ open down ↓ 2061 lines elided ↑ open up ↑
3958 3962                   * state of the zone will be set to SHUTTING_DOWN-- userland
3959 3963                   * will have to tear down the zone, and fail, or try again.
3960 3964                   */
3961 3965                  if ((zone->zone_boot_err = newproc(zone_start_init, NULL, cid,
3962 3966                      minclsyspri - 1, &ct, 0)) != 0) {
3963 3967                          mutex_enter(&zone_status_lock);
3964 3968                          zone_status_set(zone, ZONE_IS_SHUTTING_DOWN);
3965 3969                          mutex_exit(&zone_status_lock);
3966 3970                  } else {
3967 3971                          zone->zone_boot_time = gethrestime_sec();
     3972 +                        zone->zone_boot_hrtime = gethrtime();
3968 3973                  }
3969 3974  
3970 3975                  pool_unlock();
3971 3976          }
3972 3977  
3973 3978          /*
3974 3979           * Wait for zone_destroy() to be called.  This is what we spend
3975 3980           * most of our life doing.
3976 3981           */
3977 3982          zone_status_wait_cpr(zone, ZONE_IS_DYING, "zsched");
↓ open down ↓ 3197 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX