Lines Matching refs:tb

218   void (*show_process)(void *tb);
502 static char *string_field(struct procpid *tb, struct ofields *field)
506 long long *slot = tb->slot, ll = (sl >= 0) ? slot[sl&(XX-1)] : 0;
523 out = tb->str;
526 if (--sl) out += tb->offset[--sl];
535 if (which>=PS_COMM && !*out) sprintf(out = buf, "[%s]", tb->str);
609 *s++ = tb->state;
639 struct procpid *tb = p;
645 char *out = string_field(tb, field);
713 struct procpid *tb = (void *)toybuf;
714 long long *slot = tb->slot;
715 char *name, *s, *buf = tb->str, *end = 0;
726 memset(slot, 0, sizeof(tb->slot));
751 if (1>sscanf(s = end, ") %c%n", &tb->state, &i)) return 0;
762 if ((tb->str[i] = name[i]) < ' ')
763 if (!TT.tty) tb->str[i] = '?';
764 buf = tb->str+i;
811 if (slot != tb->slot) return 0;
850 // Done using buf[] (tb->str) as scratch space, now read string data,
864 tb->offset[j] = buf-(tb->str);
871 // each string we haven't checked yet, tb->str starts after the numeric
893 if (!ptb || slot[SLOT_argv0len]) ptb = tb;
986 TT.show_process(tb);
1003 struct procpid *tb;
1025 tb = (void *)new->extra;
1026 tb->slot[SLOT_tcount] = kcount;
1031 tb = (void *)dt->extra;
1032 tb->slot[SLOT_pid] = pid;
1033 tb->slot[SLOT_tcount] = kcount;
1219 struct procpid *ta = *(struct procpid **)aa, *tb = *(struct procpid **)bb;
1227 if (ta->slot[slot]<tb->slot[slot]) ret = -1;
1228 if (ta->slot[slot]>tb->slot[slot]) ret = 1;
1235 ret = strcmp(toybuf, string_field(tb, field));
1245 static struct procpid **collate_leaves(struct procpid **tb, struct dirtree *dt)
1250 if (dt->extra) *(tb++) = (void *)dt->extra;
1251 if (dt->child) tb = collate_leaves(tb, dt->child);
1256 return tb;
1463 struct procpid **tb;
1497 plnew->tb = collate(plnew->count = TT.kcount, dt);
1509 if (!plold->tb) {
1517 mix.tb = xmalloc((old.count+new.count)*sizeof(struct procpid));
1522 struct procpid *otb = old.count ? *old.tb : 0,
1523 *ntb = new.count ? *new.tb : 0;
1527 old.tb++;
1534 if (!old.count || otb->slot[merge_idx] > ntb->slot[merge_idx]) mix.tb[mix.count] = ntb;
1538 mix.tb[mix.count] = otb;
1541 old.tb++;
1544 new.tb++;
1553 qsort(mix.tb, mix.count, sizeof(struct procpid *), (void *)ksort);
1581 run[1+stridx("RTtZ", *string_field(mix.tb[i], &field))]++;
1613 if (mix.count) up = mix.tb[0]->slot[SLOT_upticks];
1630 struct procpid tb;
1632 memset(&tb, 0, sizeof(struct procpid));
1643 tb.slot[slot] += mix.tb[i]->slot[slot];
1646 field->len, string_field(&tb, field));
1670 int bold = !FLAG(b) && mix.tb[i+topoff]->state == 'R';
1674 show_ps(mix.tb[i+topoff]);
1729 free(mix.tb);
1730 for (i=0; i<plold->count; i++) free(plold->tb[i]);
1731 free(plold->tb);
1822 static void do_pgk(struct procpid *tb)
1825 if (kill(*tb->slot, TT.pgrep.signal)) {
1829 perror_msg("%s->%lld", s, *tb->slot);
1833 printf("%lld", *tb->slot);
1835 printf(" %s", tb->str+tb->offset[4]*!!FLAG(f));
1843 struct procpid *tb = p;
1846 char *name = tb->str+tb->offset[4]*!!FLAG(f);
1849 if (TT.pgrep.self == *tb->slot) return;
1867 long long ll = tb->slot[SLOT_starttime];
1874 } else do_pgk(tb);