Date: Mon, 8 Sep 2014 04:49:59 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 1199016 for review Message-ID: <201409080449.s884nx76022643@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1199016?ac=10 Change 1199016 by jhb@jhb_ralph on 2014/08/21 20:24:44 Store a timestamp in the kinfo_proc structure. Instead of storing a full timeval, just store a raw microseconds value as an int. Note that we don't care about wrapping as the point of the stamp is to compute a delta between updates. Affected files ... .. //depot/projects/smpng/sys/kern/kern_proc.c#135 edit .. //depot/projects/smpng/sys/sys/user.h#58 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_proc.c#135 (text+ko) ==== @@ -790,6 +790,7 @@ struct session *sp; struct ucred *cred; struct sigacts *ps; + struct timeval uptime; PROC_LOCK_ASSERT(p, MA_OWNED); bzero(kp, sizeof(*kp)); @@ -870,6 +871,9 @@ kp->ki_fibnum = p->p_fibnum; kp->ki_start = p->p_stats->p_start; timevaladd(&kp->ki_start, &boottime); + microuptime(&uptime); + /* Wrapping is ok as this is only used to compute deltas. */ + kp->ki_stamp = uptime.tv_sec * 1000000 + uptime.tv_usec; PROC_SLOCK(p); rufetch(p, &kp->ki_rusage); kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime); ==== //depot/projects/smpng/sys/sys/user.h#58 (text+ko) ==== @@ -84,7 +84,7 @@ * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and * function kvm_proclist in lib/libkvm/kvm_proc.c . */ -#define KI_NSPARE_INT 7 +#define KI_NSPARE_INT 6 #define KI_NSPARE_LONG 12 #define KI_NSPARE_PTR 6 @@ -187,6 +187,7 @@ */ char ki_sparestrings[50]; /* spare string space */ int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ + u_int ki_stamp; /* timestamp of record (usec) */ int ki_flag2; /* P2_* flags */ int ki_fibnum; /* Default FIB number */ u_int ki_cr_flags; /* Credential flags */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409080449.s884nx76022643>