亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? top.c

?? linux下獲取一些環境信息的代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
#ifdef CASEUP_SCALE   static char nextup[] =  { 'K', 'M', 'G', 'T', 0 };#else   static char nextup[] =  { 'k', 'm', 'g', 't', 0 };#endif   static char buf[TNYBUFSIZ];   double *dp;   char *up;      /* try an unscaled version first... */   if (width >= snprintf(buf, sizeof(buf), "%lu", num)) return buf;      /* now try successively higher types until it fits */   for (up = nextup + type, dp = scale; *dp; ++dp, ++up) {         /* the most accurate version */      if (width >= snprintf(buf, sizeof(buf), "%.1f%c", num / *dp, *up))         return buf;         /* the integer version */      if (width >= snprintf(buf, sizeof(buf), "%ld%c", (unsigned long)(num / *dp), *up))         return buf;   }      /* well shoot, this outta' fit... */   return "?";}        /*         * Do some scaling stuff.         * format 'tics' to fit 'width'. */static const char *scale_tics (TIC_t tics, const int width){#ifdef CASEUP_SCALE#define HH "%uH"#define DD "%uD"#define WW "%uW"#else#define HH "%uh"#define DD "%ud"#define WW "%uw"#endif   static char buf[TNYBUFSIZ];   unsigned long nt;    // narrow time, for speed on 32-bit   unsigned cc;         // centiseconds   unsigned nn;         // multi-purpose whatever   nt  = (tics * 100ull) / Hertz;   cc  = nt % 100;                              // centiseconds past second   nt /= 100;                                   // total seconds   nn  = nt % 60;                               // seconds past the minute   nt /= 60;                                    // total minutes   if (width >= snprintf(buf, sizeof(buf), "%lu:%02u.%02u", nt, nn, cc))      return buf;   if (width >= snprintf(buf, sizeof buf, "%lu:%02u", nt, nn))      return buf;   nn  = nt % 60;                               // minutes past the hour   nt /= 60;                                    // total hours   if (width >= snprintf(buf, sizeof buf, "%lu,%02u", nt, nn))      return buf;   nn = nt;                                     // now also hours   if (width >= snprintf(buf, sizeof buf, HH, nn))      return buf;   nn /= 24;                                    // now days   if (width >= snprintf(buf, sizeof buf, DD, nn))      return buf;   nn /= 7;                                     // now weeks   if (width >= snprintf(buf, sizeof buf, WW, nn))      return buf;      // well shoot, this outta' fit...   return "?";#undef HH#undef DD#undef WW}#include <pwd.h>static int selection_type;static uid_t selection_uid;// FIXME: this is "temporary" code we hopestatic int good_uid(const proc_t *restrict const pp){   switch(selection_type){   case 'p':      return 1;   case 0:      return 1;   case 'U':      if (pp->ruid == selection_uid) return 1;      if (pp->suid == selection_uid) return 1;      if (pp->fuid == selection_uid) return 1;      // FALLTHROUGH   case 'u':      if (pp->euid == selection_uid) return 1;      // FALLTHROUGH   default:      ;  // don't know what it is; find bugs fast   }   return 0;}// swiped from ps, and ought to be in libprocstatic const char *parse_uid(const char *restrict const str, uid_t *restrict const ret){   struct passwd *passwd_data;   char *endp;   unsigned long num;   static const char uidrange[] = "User ID out of range.";   static const char uidexist[] = "User name does not exist.";   num = strtoul(str, &endp, 0);   if(*endp != '\0'){  /* hmmm, try as login name */      passwd_data = getpwnam(str);      if(!passwd_data)    return uidexist;      num = passwd_data->pw_uid;   }   if(num > 0xfffffffeUL) return uidrange;   *ret = num;   return 0;}/*######  Library Alternatives  ##########################################*/        /*         * Handle our own memory stuff without the risk of leaving the         * user's terminal in an ugly state should things go sour. */static void *alloc_c (unsigned numb) MALLOC;static void *alloc_c (unsigned numb){   void * p;   if (!numb) ++numb;   if (!(p = calloc(1, numb)))      std_err("failed memory allocate");   return p;}static void *alloc_r (void *q, unsigned numb) MALLOC;static void *alloc_r (void *q, unsigned numb){   void *p;   if (!numb) ++numb;   if (!(p = realloc(q, numb)))      std_err("failed memory allocate");   return p;}        /*         * This guy's modeled on libproc's 'five_cpu_numbers' function except         * we preserve all cpu data in our CPU_t array which is organized         * as follows:         *    cpus[0] thru cpus[n] == tics for each separate cpu         *    cpus[Cpu_tot]        == tics from the 1st /proc/stat line */static CPU_t *cpus_refresh (CPU_t *cpus){   static FILE *fp = NULL;   int i;   int num;   // enough for a /proc/stat CPU line (not the intr line)   char buf[SMLBUFSIZ];   /* by opening this file once, we'll avoid the hit on minor page faults      (sorry Linux, but you'll have to close it for us) */   if (!fp) {      if (!(fp = fopen("/proc/stat", "r")))         std_err(fmtmk("Failed /proc/stat open: %s", strerror(errno)));      /* note: we allocate one more CPU_t than Cpu_tot so that the last slot               can hold tics representing the /proc/stat cpu summary (the first               line read) -- that slot supports our View_CPUSUM toggle */      cpus = alloc_c((1 + Cpu_tot) * sizeof(CPU_t));   }   rewind(fp);   fflush(fp);   // first value the last slot with the cpu summary line   if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");   cpus[Cpu_tot].x = 0;  // FIXME: can't tell by kernel version number   cpus[Cpu_tot].y = 0;  // FIXME: can't tell by kernel version number   cpus[Cpu_tot].z = 0;  // FIXME: can't tell by kernel version number   num = sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",      &cpus[Cpu_tot].u,      &cpus[Cpu_tot].n,      &cpus[Cpu_tot].s,      &cpus[Cpu_tot].i,      &cpus[Cpu_tot].w,      &cpus[Cpu_tot].x,      &cpus[Cpu_tot].y,      &cpus[Cpu_tot].z   );   if (num < 4)         std_err("failed /proc/stat read");   // and just in case we're 2.2.xx compiled without SMP support...   if (Cpu_tot == 1) {      cpus[1].id = 0;      memcpy(cpus, &cpus[1], sizeof(CPU_t));   }   // now value each separate cpu's tics   for (i = 0; 1 < Cpu_tot && i < Cpu_tot; i++) {      if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");      cpus[i].x = 0;  // FIXME: can't tell by kernel version number      cpus[i].y = 0;  // FIXME: can't tell by kernel version number      cpus[i].z = 0;  // FIXME: can't tell by kernel version number      num = sscanf(buf, "cpu%u %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",         &cpus[i].id,         &cpus[i].u, &cpus[i].n, &cpus[i].s, &cpus[i].i, &cpus[i].w, &cpus[i].x, &cpus[i].y, &cpus[i].z      );      if (num < 4)            std_err("failed /proc/stat read");   }   return cpus;}        /*         * Refresh procs *Helper* function to eliminate yet one more need         * to loop through our darn proc_t table.  He's responsible for:         *    1) calculating the elapsed time since the previous frame         *    2) counting the number of tasks in each state (run, sleep, etc)         *    3) maintaining the HST_t's and priming the proc_t pcpu field         *    4) establishing the total number tasks for this frame */static void prochlp (proc_t *this){   static HST_t    *hist_sav = NULL;   static HST_t    *hist_new = NULL;   static unsigned  hist_siz = 0;       // number of structs   static unsigned  maxt_sav;           // prior frame's max tasks   TIC_t tics;   if (unlikely(!this)) {      static struct timeval oldtimev;      struct timeval timev;      struct timezone timez;      HST_t *hist_tmp;      float et;      gettimeofday(&timev, &timez);      et = (timev.tv_sec - oldtimev.tv_sec)         + (float)(timev.tv_usec - oldtimev.tv_usec) / 1000000.0;      oldtimev.tv_sec = timev.tv_sec;      oldtimev.tv_usec = timev.tv_usec;      // if in Solaris mode, adjust our scaling for all cpus      Frame_tscale = 100.0f / ((float)Hertz * (float)et * (Rc.mode_irixps ? 1 : Cpu_tot));      maxt_sav = Frame_maxtask;      Frame_maxtask = Frame_running = Frame_sleepin = Frame_stopped = Frame_zombied = 0;      // reuse memory each time around      hist_tmp = hist_sav;      hist_sav = hist_new;      hist_new = hist_tmp;      // prep for our binary search by sorting the last frame's HST_t's      qsort(hist_sav, maxt_sav, sizeof(HST_t), (QFP_t)sort_HST_t);      return;   }   switch (this->state) {      case 'R':         Frame_running++;         break;      case 'S':      case 'D':         Frame_sleepin++;         break;      case 'T':         Frame_stopped++;         break;      case 'Z':         Frame_zombied++;         break;   }   if (unlikely(Frame_maxtask+1 >= hist_siz)) {      hist_siz = hist_siz * 5 / 4 + 100;  // grow by at least 25%      hist_sav = alloc_r(hist_sav, sizeof(HST_t) * hist_siz);      hist_new = alloc_r(hist_new, sizeof(HST_t) * hist_siz);   }   /* calculate time in this process; the sum of user time (utime) and      system time (stime) -- but PLEASE dont waste time and effort on      calcs and saves that go unused, like the old top! */   hist_new[Frame_maxtask].pid  = this->tid;   hist_new[Frame_maxtask].tics = tics = (this->utime + this->stime);#if 0{  int i;   int lo = 0;   int hi = maxt_sav - 1;   // find matching entry from previous frame and make ticks elapsed   while (lo <= hi) {      i = (lo + hi) / 2;      if (this->tid < hist_sav[i].pid)         hi = i - 1;      else if (likely(this->tid > hist_sav[i].pid))         lo = i + 1;      else {         tics -= hist_sav[i].tics;         break;      }   }}#else{   HST_t tmp;   const HST_t *ptr;   tmp.pid = this->tid;   ptr = bsearch(&tmp, hist_sav, maxt_sav, sizeof tmp, sort_HST_t);   if(ptr) tics -= ptr->tics;}#endif   // we're just saving elapsed tics, to be converted into %cpu if   // this task wins it's displayable screen row lottery... */   this->pcpu = tics;// if (Frames_maxcmdln) { }   // shout this to the world with the final call (or us the next time in)   Frame_maxtask++;}        /*         * This guy's modeled on libproc's 'readproctab' function except         * we reuse and extend any prior proc_t's.  He's been customized         * for our specific needs and to avoid the use of <stdarg.h> */static proc_t **procs_refresh (proc_t **table, int flags){#define PTRsz  sizeof(proc_t *)#define ENTsz  sizeof(proc_t)   static unsigned savmax = 0;          // first time, Bypass: (i)   proc_t *ptsk = (proc_t *)-1;         // first time, Force: (ii)   unsigned curmax = 0;                 // every time  (jeeze)   PROCTAB* PT;   static int show_threads_was_enabled = 0; // optimization   prochlp(NULL);                       // prep for a new frame   if (Monpidsidx)      PT = openproc(flags, Monpids);   else      PT = openproc(flags);   // i) Allocated Chunks:  *Existing* table;  refresh + reuse   if (!(CHKw(Curwin, Show_THREADS))) {      while (curmax < savmax) {         if (table[curmax]->cmdline) {            unsigned idx;            // Skip if Show_THREADS was never enabled            if (show_threads_was_enabled) {               for (idx = curmax + 1; idx < savmax; idx++) {                  if (table[idx]->cmdline == table[curmax]->cmdline)                     table[idx]->cmdline = NULL;               }            }            free(*table[curmax]->cmdline);            table[curmax]->cmdline = NULL;         }         if (unlikely(!(ptsk = readproc(PT, table[curmax])))) break;         prochlp(ptsk);                    // tally & complete this proc_t         ++curmax;      }   }   else {                          // show each thread in a process separately      while (curmax < savmax) {         proc_t *ttsk;         if (unlikely(!(ptsk = readproc(PT, NULL)))) break;         show_threads_was_enabled = 1;         while (curmax < savmax) {            unsigned idx;            if (table[curmax]->cmdline) {               // threads share the same cmdline storage.  'table' is               // qsort()ed, so must look through the rest of the table.               for (idx = curmax + 1; idx < savmax; idx++) {                  if (table[idx]->cmdline == table[curmax]->cmdline)                     table[idx]->cmdline = NULL;               }               free(*table[curmax]->cmdline);  // only free once

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久亚洲综合影院红桃| 国产精品一区在线| 欧美精品久久99| 国产精品亚洲午夜一区二区三区| 国产亚洲精品久| 欧美日本在线视频| 波多野结衣中文字幕一区| 日韩 欧美一区二区三区| 国产色综合久久| 色综合色综合色综合 | 欧美丝袜自拍制服另类| 成人黄页毛片网站| 午夜a成v人精品| 久久久久九九视频| 日本一区二区三区高清不卡| 久久久99精品久久| 国产精品家庭影院| 亚洲另类在线制服丝袜| 亚洲一区二区三区在线| 日韩中文字幕区一区有砖一区| 亚洲一二三区视频在线观看| 久久九九影视网| 欧美成人伊人久久综合网| 精品视频在线视频| 99视频一区二区| 成人性生交大片免费看视频在线 | 日韩限制级电影在线观看| 制服丝袜一区二区三区| 日韩一区二区免费高清| 日韩精品一区二区在线观看| 久久久久国产一区二区三区四区 | 日韩一区欧美二区| 亚洲国产乱码最新视频| 亚洲国产人成综合网站| 亚洲成va人在线观看| 亚洲自拍偷拍麻豆| 懂色av中文一区二区三区| 粉嫩在线一区二区三区视频| 美女视频黄 久久| 国产麻豆视频一区| 91在线视频官网| 欧美一区二区三区男人的天堂| 精品国产一区二区三区忘忧草| 丝袜美腿亚洲综合| 国产最新精品免费| 色综合久久久久综合99| 337p亚洲精品色噜噜噜| 在线看一区二区| 色婷婷av久久久久久久| 日韩一区二区视频在线观看| 亚洲精品在线免费观看视频| 一区二区欧美视频| 欧美日韩精品一区二区| 免费高清在线视频一区·| 亚洲人成网站影音先锋播放| 99久久免费视频.com| 欧美婷婷六月丁香综合色| 久久精品一区八戒影视| 亚洲国产视频直播| 国产aⅴ综合色| 欧美精品国产精品| 中文字幕在线一区二区三区| 五月综合激情婷婷六月色窝| 成人毛片在线观看| 久久午夜免费电影| 日韩成人精品在线观看| 国产麻豆精品在线| 国产欧美视频一区二区| 日韩国产成人精品| 国产欧美一区二区三区在线老狼| 亚洲一区视频在线观看视频| 日韩精品欧美成人高清一区二区| 国内成+人亚洲+欧美+综合在线 | k8久久久一区二区三区| 日本一区二区久久| 91精品免费在线观看| 中文字幕一区二区三区蜜月| 免费人成在线不卡| 欧美性淫爽ww久久久久无| 亚洲第一成年网| 成人美女视频在线看| 欧美r级在线观看| 午夜精品福利一区二区三区av| 亚洲午夜国产一区99re久久| 91成人在线免费观看| 国产精品免费aⅴ片在线观看| 久久国产三级精品| 国产精品无圣光一区二区| 美女脱光内衣内裤视频久久影院| 欧美在线观看视频一区二区| 亚洲男人的天堂在线aⅴ视频| 成人av资源网站| 亚洲色图视频网站| 国产欧美日韩卡一| 国产精品卡一卡二| 成人国产在线观看| 精品少妇一区二区三区日产乱码| 午夜精品福利在线| 欧美日韩一级视频| 午夜欧美在线一二页| 在线观看国产精品网站| 亚洲一区影音先锋| 欧美熟乱第一页| 亚洲第一成人在线| 欧美精品粉嫩高潮一区二区| 亚洲国产毛片aaaaa无费看| 色欧美片视频在线观看在线视频| 最新欧美精品一区二区三区| av亚洲精华国产精华| 中文字幕日韩精品一区 | 色综合久久久久综合99| 亚洲精品视频免费观看| 在线观看区一区二| 天堂av在线一区| 日韩欧美自拍偷拍| 韩国成人福利片在线播放| 精品国产一区二区三区四区四 | 亚洲国产成人va在线观看天堂| 欧美亚男人的天堂| 日韩二区三区在线观看| 欧美一级日韩一级| 国内精品在线播放| 中文字幕电影一区| 91麻豆国产精品久久| 亚洲成人综合网站| 日韩视频在线观看一区二区| 黑人精品欧美一区二区蜜桃| 中文幕一区二区三区久久蜜桃| 欧美日本一道本| 久草这里只有精品视频| 国产婷婷精品av在线| 97se亚洲国产综合自在线| 性感美女极品91精品| 日韩欧美国产一区在线观看| 国产成人久久精品77777最新版本| 亚洲视频网在线直播| 欧美日韩综合在线| 国产揄拍国内精品对白| 国产精品萝li| 欧美精选一区二区| 国产精品18久久久久| 欧美tk—视频vk| www国产精品av| 亚洲精品在线网站| 久久久久久亚洲综合影院红桃| 日韩欧美成人一区| 久久久噜噜噜久久人人看| 久久综合丝袜日本网| 精品国产91亚洲一区二区三区婷婷| 欧美精品亚洲一区二区在线播放| 在线精品视频免费播放| 欧美精品三级日韩久久| 欧美一区二区三区小说| 精品久久久三级丝袜| 久久综合99re88久久爱| 久久久影视传媒| 国产精品久久久久影院色老大| 成人免费在线视频观看| 一区二区三区精密机械公司| 亚洲精品乱码久久久久久黑人| 亚洲最新在线观看| 成人精品视频一区二区三区尤物| 69久久夜色精品国产69蝌蚪网| 亚洲精品国产高清久久伦理二区| 樱花草国产18久久久久| 亚洲色图.com| 婷婷久久综合九色综合绿巨人 | 97se亚洲国产综合自在线| 日韩和欧美一区二区| 国产精品麻豆欧美日韩ww| 日韩一级免费观看| 在线观看成人免费视频| 国产91在线看| 捆绑紧缚一区二区三区视频| 亚洲制服丝袜一区| 中文字幕在线免费不卡| 日韩欧美卡一卡二| 欧美日韩国产在线观看| 男男gaygay亚洲| 色婷婷av一区二区三区gif| 26uuu成人网一区二区三区| 亚洲美女精品一区| 国产成人免费视频网站| 制服丝袜亚洲网站| 亚洲激情男女视频| 国产伦精品一区二区三区在线观看| 成人av资源在线| 国产欧美日韩不卡| 国内外成人在线| 欧美一级日韩一级| 丝袜美腿亚洲色图| 亚洲精品一区在线观看| 91麻豆自制传媒国产之光| 国产在线看一区| 日韩亚洲欧美在线| 欧美在线色视频| 一本大道av一区二区在线播放| 成人教育av在线| www.欧美精品一二区| 成人一级片网址|