void benchmark_work_fork(const char *filepath, const char *filename, benchmark_work_callback_f callback, FILE *out_fh) { struct benchmark_res_html res = benchmark_load_html_file(filepath); struct benchmark_ctx ctx = {0, 0, NULL, 0}; size_t mem_start = proc_stat_getCurrentRSS(); uint64_t time_start = myhtml_hperf_clock(); callback(filename, res.html, res.size, &ctx); uint64_t time_end = myhtml_hperf_clock(); size_t mem_end = proc_stat_getPeakRSS(); free(res.html); long long mem_used = mem_end - mem_start; double work_time = myhtml_absolute_difference(time_start, time_end); fprintf(out_fh, "\"%s\";%zu;%0.5f;%lld\n", filename, res.size, work_time, mem_used); }
void benchmark_work(const char *filepath, const char *filename, benchmark_work_callback_f callback, struct benchmark_ctx *ctx, FILE *out_fh) { struct benchmark_res_html res = benchmark_load_html_file(filepath); uint64_t time_start = myhtml_hperf_clock(); callback(filename, res.html, res.size, ctx); uint64_t time_end = myhtml_hperf_clock(); free(res.html); double work_time = myhtml_absolute_difference(time_start, time_end); ctx->count++; ctx->sum += work_time; ctx->total_file_size += res.size; fprintf(out_fh, "\"%s\";%zu;%0.5f;%lld\n", filename, res.size, work_time, 0LL); }