profile atlas recreation
This commit is contained in:
@ -320,14 +320,15 @@ void profile_start(char profile[const static 1]) {
|
||||
void profile_end(char profile[const static 1]) {
|
||||
struct ProfileItem *p = shgetp_null(profiles, profile);
|
||||
if (!p) {
|
||||
log_warn("profile %s wasn't started!", profile);
|
||||
log_warn("Profile %s wasn't started!", profile);
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t took = SDL_GetPerformanceCounter() - p->value.tick_start;
|
||||
|
||||
p->value.sample_count++;
|
||||
p->value.tick_accum += took;
|
||||
p->value.sample_count++;
|
||||
|
||||
if (p->value.worst_tick < took)
|
||||
p->value.worst_tick = took;
|
||||
}
|
||||
@ -342,16 +343,16 @@ void profile_list_stats(void) {
|
||||
else if (profiles[i].value.sample_count == 1) {
|
||||
log_info("Profile '%s' took: %f seconds",
|
||||
profiles[i].key,
|
||||
(double)profiles[i].value.tick_accum / 1 / (double)(SDL_GetPerformanceFrequency()));
|
||||
(double)profiles[i].value.tick_accum / (double)(SDL_GetPerformanceFrequency()));
|
||||
}
|
||||
|
||||
else if (profiles[i].value.sample_count > 1) {
|
||||
log_info("Profile '%s' on average took: %f seconds, worst case: %s, sample count: %llu",
|
||||
log_info("Profile '%s' on average took: %f seconds, worst case: %f, sample count: %llu",
|
||||
profiles[i].key,
|
||||
(double)profiles[i].value.tick_accum /
|
||||
(double)profiles[i].value.sample_count /
|
||||
(double)(SDL_GetPerformanceFrequency()),
|
||||
(double)profiles[i].value.worst_tick / 1 / (double)(SDL_GetPerformanceFrequency()),
|
||||
(double)profiles[i].value.worst_tick / (double)(SDL_GetPerformanceFrequency()),
|
||||
profiles[i].value.sample_count);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user