Skip to content

Commit

Permalink
improve metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
blackav committed Nov 3, 2024
1 parent eff1b04 commit 8f24df7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
20 changes: 19 additions & 1 deletion csp/contests/priv_server_info_page.csp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
<td class="b1">Submitted runs:</td>
<td class="b1"><s:v value="mcd->runs_submitted" /></td>
</tr>
<tr>
<td class="b1">Submitted submits:</td>
<td class="b1"><s:v value="mcd->submits_submitted" /></td>
</tr>
<tr>
<td class="b1">Time spent on compilation (ms):</td>
<td class="b1"><s:v value="mcd->total_compile_time_ms" /></td>
Expand Down Expand Up @@ -161,12 +165,26 @@
if (mcd->append_run_count > 0) {
%>
<tr>
<td class="b1">Average INSERT time (μs):</td>
<td class="b1">Average INSERT INTO runs time (μs):</td>
<td class="b1"><s:v value="mcd->append_run_us / mcd->append_run_count" /></td>
</tr>
<%
}
%>
<tr>
<td class="b1">'<tt>INSERT INTO submits</tt>' operations:</td>
<td class="b1"><s:v value="mcd->append_submit_count" /></td>
</tr>
<%
if (mcd->append_submit_count > 0) {
%>
<tr>
<td class="b1">Average INSERT INTO submits time (μs):</td>
<td class="b1"><s:v value="mcd->append_submit_us / mcd->append_submit_count" /></td>
</tr>
<%
}
%>

</table>

Expand Down
5 changes: 4 additions & 1 deletion include/ejudge/metrics_contest.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef __METRICS_CONTEST_H__
#define __METRICS_CONTEST_H__

/* Copyright (C) 2022-2023 Alexander Chernov <[email protected]> */
/* Copyright (C) 2022-2024 Alexander Chernov <[email protected]> */

/*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -42,6 +42,9 @@ struct metrics_contest_data
long long key_cache_size;
long long append_run_us;
long long append_run_count;
int submits_submitted;
long long append_submit_us;
long long append_submit_count;
};

struct metrics_desc
Expand Down
3 changes: 3 additions & 0 deletions lib/new_server_html.c
Original file line number Diff line number Diff line change
Expand Up @@ -15299,6 +15299,9 @@ ns_submit_run_input(
err_num = NEW_SRV_ERR_RUNLOG_UPDATE_FAILED;
goto done;
}
if (metrics.data) {
++metrics.data->submits_submitted;
}

ej_uuid_generate(&se.judge_uuid);
r = serve_compile_request(phr->config,
Expand Down

0 comments on commit 8f24df7

Please sign in to comment.