1
0

remove unused code

This commit is contained in:
Rokas Puzonas 2023-07-12 18:58:04 +03:00
parent a3e9b4c153
commit 973bfe4bd6
3 changed files with 4 additions and 27 deletions

View File

@ -294,7 +294,7 @@ int parse_json_string(struct json_string *result, char *data, size_t data_size)
PROF_START("parse_json_string()");
assert(expect_char(data, data_size, '"'));
int json_string_size = get_json_string_size(data, data_size);
u32 json_string_size = get_json_string_size(data, data_size);
result->str = malloc((json_string_size-2)*sizeof(char));
result->size = 0;

View File

@ -105,7 +105,7 @@ void prof_output()
}
}
printf("\nTotal time taken: %.3fms\n", (float)total_time*1000/cpu_hz);
printf("\nTotal time taken: %.3fms (%lu)\n", (float)total_time*1000/cpu_hz, total_time);
char line_format[128];
snprintf(line_format, ARRAY_LEN(line_format), " %%%ds - %%9lu (%%6.3f%%%%, %%7.3f%%%% w/children) [%%d]\n", label_width);
@ -122,7 +122,8 @@ void prof_output()
}
u64 other_duration = total_time - profiled_duration;
printf(line_format, "Other", other_duration, (f32)other_duration*100/total_time, 0.0, 1);
f32 other_percent = (f32)other_duration*100/total_time;
printf(line_format, "Other", other_duration, other_percent, other_percent, 1);
}
#define PROF_START(label) prof_start(__COUNTER__, label)

View File

@ -68,28 +68,4 @@ static u64 get_cpu_timer_hz(u64 measure_time_ms)
}
}
#define START_TIMER(display) { \
.start = read_cpu_timer(), \
.end = 0, \
.name = display \
}
#define END_TIMER(timespan) timespan.end = read_cpu_timer()
#define TIMER_DURATION(timer) (timer.end - timer.start)
struct timer {
char *name;
u64 start, end;
};
static u64 sum_timer(struct timer *timers, size_t count)
{
u64 sum = 0;
for (int i = 0; i < count; i++) {
sum += TIMER_DURATION(timers[i]);
}
return sum;
}
#endif //TIMER_