Mercurial > repos > rhope
comparison runtime/func.h @ 151:b75ec364cecc
Fix conflict between name of proviling variable and time function in C stdlib
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 05 Dec 2010 18:04:19 -0500 |
parents | 7bbdc034e347 |
children | d1e206ff75f9 |
comparison
equal
deleted
inserted
replaced
150:50c97b448f44 | 151:b75ec364cecc |
---|---|
36 #define MethodName(name,type) f_ ## name ## AT_ ## type | 36 #define MethodName(name,type) f_ ## name ## AT_ ## type |
37 | 37 |
38 #ifdef ENABLE_PROFILING | 38 #ifdef ENABLE_PROFILING |
39 | 39 |
40 #define START_PROFILE \ | 40 #define START_PROFILE \ |
41 gettimeofday(&time, NULL);\ | 41 gettimeofday(&proftime, NULL);\ |
42 cdata->accum = cdata->self_accum = 0;\ | 42 cdata->accum = cdata->self_accum = 0;\ |
43 cdata->self_start = cdata->start = ((uint64_t)time.tv_sec) * 1000000ULL + ((uint64_t)time.tv_usec); | 43 cdata->self_start = cdata->start = ((uint64_t)proftime.tv_sec) * 1000000ULL + ((uint64_t)proftime.tv_usec); |
44 | 44 |
45 #define PAUSE_SELF \ | 45 #define PAUSE_SELF \ |
46 gettimeofday(&time, NULL);\ | 46 gettimeofday(&proftime, NULL);\ |
47 my_cdata->self_accum += ((uint64_t)time.tv_sec) * 1000000ULL + ((uint64_t)time.tv_usec) - my_cdata->self_start; | 47 my_cdata->self_accum += ((uint64_t)proftime.tv_sec) * 1000000ULL + ((uint64_t)proftime.tv_usec) - my_cdata->self_start; |
48 | 48 |
49 #define AND_TOTAL \ | 49 #define AND_TOTAL \ |
50 *(my_cdata->myactivationlevel)--;\ | 50 *(my_cdata->myactivationlevel)--;\ |
51 my_cdata->accum += ((uint64_t)time.tv_sec) * 1000000ULL + ((uint64_t)time.tv_usec) - my_cdata->start; | 51 my_cdata->accum += ((uint64_t)proftime.tv_sec) * 1000000ULL + ((uint64_t)proftime.tv_usec) - my_cdata->start; |
52 | 52 |
53 #define RESUME_SELF \ | 53 #define RESUME_SELF \ |
54 gettimeofday(&time, NULL);\ | 54 gettimeofday(&proftime, NULL);\ |
55 my_cdata->self_start = ((uint64_t)time.tv_sec) * 1000000ULL + ((uint64_t)time.tv_usec); | 55 my_cdata->self_start = ((uint64_t)proftime.tv_sec) * 1000000ULL + ((uint64_t)proftime.tv_usec); |
56 | 56 |
57 #define AND_RESUME_TOTAL \ | 57 #define AND_RESUME_TOTAL \ |
58 *(my_cdata->myactivationlevel)++;\ | 58 *(my_cdata->myactivationlevel)++;\ |
59 my_cdata->start = my_cdata->self_start; | 59 my_cdata->start = my_cdata->self_start; |
60 | 60 |
61 #define EndFunc(name) \ | 61 #define EndFunc(name) \ |
62 free_stack(ct, lv_ ## name);\ | 62 free_stack(ct, lv_ ## name);\ |
63 func = cdata->func;\ | 63 func = cdata->func;\ |
64 profile_activationlevel[FUNC_ ## name]--;\ | 64 profile_activationlevel[FUNC_ ## name]--;\ |
65 gettimeofday(&time, NULL);\ | 65 gettimeofday(&proftime, NULL);\ |
66 if(profile_activationlevel[FUNC_ ## name])\ | 66 if(profile_activationlevel[FUNC_ ## name])\ |
67 {\ | 67 {\ |
68 profile_nestedcounts[FUNC_ ## name]++;\ | 68 profile_nestedcounts[FUNC_ ## name]++;\ |
69 } else {\ | 69 } else {\ |
70 profile_counts[FUNC_ ## name]++;\ | 70 profile_counts[FUNC_ ## name]++;\ |
71 profile_totals[FUNC_ ## name] += ((uint64_t)time.tv_sec) * 1000000ULL + ((uint64_t)time.tv_usec) - cdata->start + cdata->accum;\ | 71 profile_totals[FUNC_ ## name] += ((uint64_t)proftime.tv_sec) * 1000000ULL + ((uint64_t)proftime.tv_usec) - cdata->start + cdata->accum;\ |
72 }\ | 72 }\ |
73 profile_selftotals[FUNC_ ## name] += ((uint64_t)time.tv_sec) * 1000000ULL + ((uint64_t)time.tv_usec) - cdata->self_start + cdata->self_accum; | 73 profile_selftotals[FUNC_ ## name] += ((uint64_t)proftime.tv_sec) * 1000000ULL + ((uint64_t)proftime.tv_usec) - cdata->self_start + cdata->self_accum; |
74 | 74 |
75 #define Func(name,numparams) \ | 75 #define Func(name,numparams) \ |
76 f_ ## name:\ | 76 f_ ## name:\ |
77 for(idx = numparams; idx < cdata->num_params; ++idx)\ | 77 for(idx = numparams; idx < cdata->num_params; ++idx)\ |
78 release_ref(cdata->params[idx]); cdata->num_params = numparams;\ | 78 release_ref(cdata->params[idx]); cdata->num_params = numparams;\ |