在Solaris中,
我需要從內核空間和用戶空間獲取進程啓動時間。
我發現一個給定過程的2個開始時間,它們是不相等的!
其中一個位於proc struct(鏈接舊,但結構幾乎相同),另一個位於ps_info struct。
在執行過程中,在內核空間,如果我使用比較struct proc中的starttime和solaris中的struct psinfo_t
struct proc* iterated_process_ptr = curproc;
我得到以下結構:
typedef struct proc {
/*
* Microstate accounting, resource usage, and real-time profiling
*/
hrtime_t p_mstart; /* hi-res process start time */
如果我填補從用戶空間結構psinfo_t這樣的:
char psfile[64];
psinfo_t psinfo;
sprintf(psfile, "/proc/ProcessID/psinfo");
if ((fd = open(psfile, O_RDONLY)) >= 0)
if (read(fd, &psinfo, sizeof(psinfo_t)) != -1)
結構psinfo被填充,它看起來像:
typedef struct psinfo {
timestruc_t pr_start; /* process start time, from the epoch */
2個開始時間有什麼區別?
如果我爲同一過程進行操作,值不同,這意味着高分辨率過程開始時間與過程時期開始時間不同。
什麼是高分辨率過程開始?
感謝