Lines Matching refs:api

230    APInfo* api   = NULL;
236 api = (APInfo*)valW;
239 api = VG_(malloc)( "dh.main.intro_Block.1", sizeof(APInfo) );
240 VG_(memset)(api, 0, sizeof(*api));
241 api->ap = bk->ap;
243 (UWord)bk->ap, (UWord)api );
246 tl_assert(api->deaths == 0);
247 api->xsize_tag = Unknown;
248 api->xsize = 0;
249 if (0) VG_(printf)("api %p --> Unknown\n", api);
252 tl_assert(api->ap == bk->ap);
257 api->cur_blocks_live++;
260 api->cur_bytes_live += bk->req_szB;
261 if (api->cur_bytes_live > api->max_bytes_live) {
262 api->max_bytes_live = api->cur_bytes_live;
263 api->max_blocks_live = api->cur_blocks_live;
267 api->tot_blocks++;
268 api->tot_bytes += bk->req_szB;
296 APInfo* api = NULL;
303 api = (APInfo*)valW;
304 tl_assert(api->ap == bk->ap);
308 VG_(printf)("ec %p api->c_by_l %llu bk->rszB %llu\n",
309 bk->ap, api->cur_bytes_live, (ULong)bk->req_szB);
313 tl_assert(api->cur_blocks_live >= 1);
314 tl_assert(api->cur_bytes_live >= bk->req_szB);
315 api->cur_blocks_live--;
316 api->cur_bytes_live -= bk->req_szB;
318 api->deaths++;
321 api->death_ages_sum += (g_guest_instrs_executed - bk->allocd_at);
331 api->n_reads += bk->n_reads;
332 api->n_writes += bk->n_writes;
335 switch (api->xsize_tag) {
338 tl_assert(api->xsize == 0);
339 tl_assert(api->deaths == 1 || api->deaths == 0);
340 tl_assert(!api->histo);
341 api->xsize_tag = Exactly;
342 api->xsize = bk->req_szB;
343 if (0) VG_(printf)("api %p --> Exactly(%lu)\n", api, api->xsize);
346 api->histo = VG_(malloc)("dh.main.retire_Block.1",
347 api->xsize * sizeof(UInt));
348 VG_(memset)(api->histo, 0, api->xsize * sizeof(UInt));
353 //tl_assert(api->deaths > 1);
354 if (bk->req_szB != api->xsize) {
355 if (0) VG_(printf)("api %p --> Mixed(%lu -> %lu)\n",
356 api, api->xsize, bk->req_szB);
357 api->xsize_tag = Mixed;
358 api->xsize = 0;
360 if (api->histo) {
361 VG_(free)(api->histo);
362 api->histo = NULL;
368 //tl_assert(api->deaths > 1);
377 if (api->xsize_tag == Exactly && api->histo && bk->histoW) {
378 tl_assert(api->xsize == bk->req_szB);
380 for (i = 0; i < api->xsize; i++) {
381 // FIXME: do something better in case of overflow of api->histo[..]
383 if (api->histo[i] <= 0xFFFE0000)
384 api->histo[i] += (UInt)bk->histoW[i];
386 if (0) VG_(printf)("fold in, AP = %p\n", api);
408 APInfo* api = NULL;
415 api = (APInfo*)valW;
416 tl_assert(api->ap == ec);
419 tl_assert(api->cur_bytes_live >= -delta);
424 api->cur_bytes_live += delta;
427 if (delta > 0 && api->cur_bytes_live > api->max_bytes_live) {
428 api->max_bytes_live = api->cur_bytes_live;
429 api->max_blocks_live = api->cur_blocks_live;
442 api->tot_bytes += delta;
1095 static void show_APInfo ( APInfo* api )
1099 if (api->tot_blocks > 0) {
1100 show_N_div_100( bufA, ((ULong)api->tot_bytes * 100ULL)
1101 / (ULong)api->tot_blocks );
1107 api->max_bytes_live, api->max_blocks_live);
1109 api->tot_bytes, api->tot_blocks, bufA);
1111 tl_assert(api->tot_blocks >= api->max_blocks_live);
1112 tl_assert(api->tot_bytes >= api->max_bytes_live);
1114 if (api->deaths > 0) {
1116 ULong aad = api->deaths == 0
1117 ? 0 : (api->death_ages_sum / api->deaths);
1128 api->deaths, aad, buf );
1136 if (api->tot_bytes > 0) {
1137 show_N_div_100(bufR, (100ULL * api->n_reads) / api->tot_bytes);
1138 show_N_div_100(bufW, (100ULL * api->n_writes) / api->tot_bytes);
1147 api->n_reads, api->n_writes);
1149 VG_(pp_ExeContext)(api->ap);
1151 if (api->histo && api->xsize_tag == Exactly) {
1155 if (api->xsize > 0)
1157 for (i = 0; i < api->xsize; i++) {
1158 if (i > 0 && (i % 16) == 0 && i != api->xsize-1) {
1162 VG_(umsg)("%u ", api->histo[i]);
1170 static ULong get_metric__max_bytes_live ( APInfo* api ) {
1171 return api->max_bytes_live;
1173 static ULong get_metric__tot_bytes ( APInfo* api ) {
1174 return api->tot_bytes;
1176 static ULong get_metric__max_blocks_live ( APInfo* api ) {
1177 return api->max_blocks_live;
1230 APInfo* api = (APInfo*)valW;
1231 tl_assert(api && api->ap == (ExeContext*)keyW);
1232 api->shown = False;
1244 APInfo* api = (APInfo*)valW;
1245 if (api->shown)
1247 ULong metric = get_metric(api);
1250 best_api = api;