MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / quantize_ctrace

Function quantize_ctrace

util/quantize.c:122–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122int quantize_ctrace(struct quantize *q, char *title)
123{
124 int i, *cnt = q->cnts, zerosinarow;
125 int maxcnt, linelength;
126 static char *line =
127 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*****";
128 if (q->numvals == 0)
129 return 0;
130 ctrace("%s\n", title);
131 if (cnt == 0) {
132 int sz = sizeof(int) * (q->qnum + 1);
133 cnt = (int *)alloca(sz);
134 memset(cnt, 0, sz);
135 }
136 for (maxcnt = 0, i = 0; i <= q->qnum; i++)
137 if (maxcnt < cnt[i])
138 maxcnt = cnt[i];
139 ctrace("<=%.8s -- avg %-8lld -- min %-8d -- max %-8d -- count\n",
140 q->units_name, (long long)(q->sumval / q->numvals), q->minval,
141 q->maxval);
142 zerosinarow = 0;
143 for (i = 0; i <= q->qnum; i++) {
144 if (maxcnt == 0)
145 linelength = 0;
146 else
147 linelength = (double)cnt[i] * (double)50 / (double)maxcnt;
148 if (cnt[i] == 0) {
149 zerosinarow++;
150 continue;
151 }
152 if (zerosinarow > 1)
153 ctrace(" ...\n");
154 zerosinarow = 0;
155 if (i == q->qnum)
156 ctrace(" >|%-50.*s %-8d\n", linelength, line, cnt[i]);
157 else
158 ctrace(" %6d|%-50.*s %-8d\n", i * q->step, linelength, line,
159 cnt[i]);
160 }
161 return 0;
162}
163
164/* dump distribution table */
165int quantize_dump(struct quantize *q, FILE *ff)

Callers 1

accept_threadFunction · 0.85

Calls 1

ctraceFunction · 0.85

Tested by

no test coverage detected