comparison cbackend.rhope @ 116:60906f8803ef

Improved profiling
author Mike Pavone <pavone@retrodev.com>
date Wed, 13 Oct 2010 02:51:56 -0400
parents fd23ab2c1a73
children 72c648bca43b
comparison
equal deleted inserted replaced
115:04148770c229 116:60906f8803ef
1482 constants]] 1482 constants]]
1483 ]Append[Fold[["_Text C Program"]Set Input[2, [program]Type Registry >>], "", Filter[[program]Functions >>, "Not Native"]]] 1483 ]Append[Fold[["_Text C Program"]Set Input[2, [program]Type Registry >>], "", Filter[[program]Functions >>, "Not Native"]]]
1484 ]Append["\n 1484 ]Append["\n
1485 #ifdef ENABLE_PROFILING 1485 #ifdef ENABLE_PROFILING
1486 uint64_t profile_counts[END]; 1486 uint64_t profile_counts[END];
1487 uint64_t profile_nestedcounts[END];
1487 uint64_t profile_totals[END]; 1488 uint64_t profile_totals[END];
1488 uint64_t profile_selftotals[END]; 1489 uint64_t profile_selftotals[END];
1490 uint64_t profile_activationlevel[END];
1489 #endif 1491 #endif
1490 1492
1491 int32_t rhope(uint32_t func, object ** params, uint16_t numparams, uint16_t callspace) 1493 int32_t rhope(uint32_t func, object ** params, uint16_t numparams, uint16_t callspace)
1492 { 1494 {
1493 #ifdef ENABLE_PROFILING 1495 #ifdef ENABLE_PROFILING
1611 1613
1612 #ifdef ENABLE_PROFILING 1614 #ifdef ENABLE_PROFILING
1613 for (idx = 0; idx < END; ++idx) 1615 for (idx = 0; idx < END; ++idx)
1614 { 1616 {
1615 if(profile_counts[idx]) 1617 if(profile_counts[idx])
1616 printf(\"Func: %d\tCount: %llu\tTime: %llu\tAvg: %f\tSelf: %llu\tAvg: %f\\n\", idx, profile_counts[idx], profile_totals[idx], ((double)profile_totals[idx])/((double)profile_counts[idx]), profile_selftotals[idx], ((double)profile_selftotals[idx])/((double)profile_counts[idx])); 1618 printf(\"Func: %d\tCount: %llu\tTime: %llu\tAvg: %f\tSelf: %llu\tAvg: %f\tNested Count: %llu\\n\", idx, profile_counts[idx], profile_totals[idx], ((double)profile_totals[idx])/((double)profile_counts[idx]), profile_selftotals[idx], ((double)profile_selftotals[idx])/((double)profile_counts[idx]), profile_nestedcounts[idx]);
1617 } 1619 }
1618 #endif 1620 #endif
1619 if (!numret) 1621 if (!numret)
1620 return 0; 1622 return 0;
1621 if (numret < 0) 1623 if (numret < 0)