Skip to content

Commit

Permalink
Make results table show cpu or wall time based on which one was set.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Krulis committed Jan 23, 2018
1 parent afce002 commit bb1cc9a
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 19 deletions.
121 changes: 102 additions & 19 deletions src/components/Submissions/TestResultsTable/TestResultsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import exitCodeMapping from '../../helpers/exitCodeMapping';
const hasValue = value => value !== null;

const tickOrCrossAndRatioOrValue = (isOK, ratio, value, pretty, multiplier) =>
<td
<span
className={classNames({
'text-center': true,
'text-success': isOK,
Expand All @@ -32,7 +32,81 @@ const tickOrCrossAndRatioOrValue = (isOK, ratio, value, pretty, multiplier) =>
{hasValue(value) && ') '}
{hasValue(value) && pretty(value * multiplier)}
</small>
</td>;
</span>;

const showTimeResults = (
key,
wallTime,
wallTimeRatio,
wallTimeExceeded,
cpuTime,
cpuTimeRatio,
cpuTimeExceeded
) => {
const showWall =
Boolean(wallTimeRatio) || (wallTimeExceeded && !cpuTimeExceeded);
const showCpu = Boolean(cpuTimeRatio) || cpuTimeExceeded || !showWall;
return (
<table style={{ display: 'inline-block' }}>
<tbody>
{showCpu &&
<tr>
<td className="text-muted">
<OverlayTrigger
placement="top"
overlay={
<Tooltip id="wall-time-icon">
<FormattedMessage
id="app.submissions.testResultsTable.cpuTimeExplain"
defaultMessage="CPU time (total time the CPU was used by all threads)"
/>
</Tooltip>
}
>
<Icon name="microchip" style={{ marginRight: '10px' }} />
</OverlayTrigger>
</td>
<td className="text-left">
{tickOrCrossAndRatioOrValue(
cpuTimeExceeded === false,
cpuTimeRatio,
cpuTime,
prettyMs,
1000
)}
</td>
</tr>}
{showWall &&
<tr>
<td className="text-muted">
<OverlayTrigger
placement="top"
overlay={
<Tooltip id="wall-time-icon">
<FormattedMessage
id="app.submissions.testResultsTable.wallTimeExplain"
defaultMessage="Wall time (real-time measured by external clock)"
/>
</Tooltip>
}
>
<Icon name="clock-o" style={{ marginRight: '10px' }} />
</OverlayTrigger>
</td>
<td className="text-left">
{tickOrCrossAndRatioOrValue(
wallTimeExceeded === false,
wallTimeRatio,
wallTime,
prettyMs,
1000
)}
</td>
</tr>}
</tbody>
</table>
);
};

const TestResultsTable = ({ results, runtimeEnvironmentId }) =>
<Table responsive>
Expand Down Expand Up @@ -85,7 +159,7 @@ const TestResultsTable = ({ results, runtimeEnvironmentId }) =>
>
<span>
<Icon name="thermometer-half" />&nbsp;&nbsp;
<Icon name="microchip" />
<Icon name="braille" />
</span>
</OverlayTrigger>
</th>
Expand Down Expand Up @@ -133,11 +207,14 @@ const TestResultsTable = ({ results, runtimeEnvironmentId }) =>
status,
memoryExceeded,
wallTimeExceeded,
cpuTimeExceeded,
message,
wallTimeRatio,
memoryRatio,
wallTime,
wallTimeRatio,
cpuTimeRatio,
memory,
wallTime,
cpuTime,
exitCode
}) =>
<tr key={testName}>
Expand Down Expand Up @@ -181,20 +258,26 @@ const TestResultsTable = ({ results, runtimeEnvironmentId }) =>
</b>
</td>

{tickOrCrossAndRatioOrValue(
memoryExceeded === false,
memoryRatio,
memory,
prettyPrintBytes,
1024
)}
{tickOrCrossAndRatioOrValue(
wallTimeExceeded === false,
wallTimeRatio,
wallTime,
prettyMs,
1000
)}
<td className="text-center">
{tickOrCrossAndRatioOrValue(
memoryExceeded === false,
memoryRatio,
memory,
prettyPrintBytes,
1024
)}
</td>
<td className="text-center">
{showTimeResults(
testName,
wallTime,
wallTimeRatio,
wallTimeExceeded,
cpuTime,
cpuTimeRatio,
cpuTimeExceeded
)}
</td>

<td className="text-center">
{exitCodeMapping(runtimeEnvironmentId, exitCode)}
Expand Down
31 changes: 31 additions & 0 deletions src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"app.confirm.no": "Ne",
"app.confirm.yes": "Ano",
"app.createGroup.externalId": "Externí identifikátor skupiny (například ID ze školního informačního systému):",
"app.createGroup.hasThreshold": "Students require cetrain number of points to complete the course",
"app.createGroup.isPublic": "Studenti se mohou sami přidávat k této skupině",
"app.createGroup.publicStats": "Studenti mohou vidět dosažené body ostatních",
"app.createGroup.threshold": "Minimální procentuální hranice potřebná ke splnění tohoto kurzu:",
Expand Down Expand Up @@ -375,6 +376,8 @@
"app.editSimpleLimitsField.tooltip.cloneHorizontal": "Copy this value horizontally to all environments of the test.",
"app.editSimpleLimitsField.tooltip.cloneVertical": "Copy this value vertically to all tests within the environment.",
"app.editSimpleLimitsForm.failed": "Nepodařilo se uložit limity. Prosím, opakujte akci později.",
"app.editSimpleLimitsForm.preciseTime": "Precise Time Measurement",
"app.editSimpleLimitsForm.preciseTimeTooltip": "If precise time measurement is selected, ReCodEx will measure the consumed CPU time of tested soltions. Otherwise, the wall time will be measured. CPU is better in cases when serial time complexity of the solution is tested and tight time limits are set. Wall time is better in general cases as it better reflects the actual time consumed by the solution (indcluing I/O), but it is more susceptible to errors of measurement.",
"app.editSimpleLimitsForm.reset": "Obnovit původní",
"app.editSimpleLimitsForm.submit": "Uložit limity",
"app.editSimpleLimitsForm.submitting": "Ukládám limity ...",
Expand All @@ -397,9 +400,12 @@
"app.editTestsTest.remove": "Odebrat",
"app.editTestsTest.weight": "Váha testu:",
"app.editUser.description": "Upravit nastavení uživatele",
"app.editUser.makeLocal": "Create local account",
"app.editUser.title": "Upravit uživatelský profil",
"app.editUserProfile.degreesAfterName": "Tituly za jménem:",
"app.editUserProfile.degreesBeforeName": "Tituly před jménem:",
"app.editUserProfile.emptyLocalPassword": "Local account does not have a password",
"app.editUserProfile.emptyLocalPasswordExplain": "You may not sign in to ReCodEx using local account until you set the password.",
"app.editUserProfile.firstName": "Jméno:",
"app.editUserProfile.lastName": "Příjmění:",
"app.editUserProfile.passwordInstructions": "Pokud nechcete změnit heslo, nechte tato pole prázná",
Expand Down Expand Up @@ -627,6 +633,12 @@
"app.failedGroupDetail.msg": "Načtení skupiny se nezdařilo. Prosíme zkuste dotaz opakovat později.",
"app.failedSubmissionDetail.description": "Prosíme zkontroluje své připojení k internetu a zkuste dotaz později.",
"app.failedSubmissionDetail.title": "Načtení vyhodnocení úlohy se nezdařilo",
"app.failureList.headCreatedAt": "Created at",
"app.failureList.headDescription": "Description",
"app.failureList.headResolutionNote": "Resolution note",
"app.failureList.headResolvedAt": "Resolved at",
"app.failureList.headType": "Type",
"app.failureList.noFailures": "There are no failures in this list.",
"app.faq.description": "ReCodEx FAQ",
"app.faq.title": "FAQ",
"app.feedbackAndBugs.contribution": "If you are interested in frontend web development, feel free to fix the bug itself and send a pull request! Any help will be much appreciated!",
Expand Down Expand Up @@ -865,6 +877,7 @@
"app.referenceSolutionDetail.exercise": "Exercise",
"app.referenceSolutionDetail.refreshEvaluations": "Obnovit",
"app.referenceSolutionDetail.resubmit": "Znovu vyhodnotit",
"app.referenceSolutionDetail.resubmitDebug": "Resubmit in Debug Mode",
"app.referenceSolutionDetail.title.details": "Detail referenčního řešení",
"app.referenceSolutionDetail.uploadedAt": "Nahráno:",
"app.referenceSolutionEvaluation.title": "Evaluations of reference solution",
Expand Down Expand Up @@ -918,6 +931,7 @@
"app.resultsTable.total": "Celkem",
"app.search.query": "Vyhledaný dotaz: ",
"app.search.title": "Hledat:",
"app.sidebar.menu.admin.failures": "Submission Failures",
"app.sidebar.menu.admin.instances": "Instance",
"app.sidebar.menu.admin.users": "Uživatelé",
"app.sidebar.menu.createAccount": "Zaregistrovat se",
Expand Down Expand Up @@ -983,15 +997,32 @@
"app.submissionEvaluation.select": "Select",
"app.submissionEvaluation.selected": "Selected",
"app.submissionEvaluation.title": "Other submissions of this solution",
"app.submissionFailures.description": "Browse all submission failures",
"app.submissionFailures.failed": "Cannot load the list of failures",
"app.submissionFailures.failedDescription": "We are sorry for the inconvenience, please try again later.",
"app.submissionFailures.listTitle": "Submission Failures",
"app.submissionFailures.loading": "Loading list of failures ...",
"app.submissionFailures.loadingDescription": "Please wait while we are getting the list of failures ready.",
"app.submissionFailures.resolve": "Resolve",
"app.submissionFailures.resolveClose": "Close",
"app.submissionFailures.resolveMaxLengthExceeded": "Maximum length of the note exceeded.",
"app.submissionFailures.resolveNote": "Resolve note:",
"app.submissionFailures.resolveSave": "Save",
"app.submissionFailures.resolveSaving": "Saving ...",
"app.submissionFailures.resolveSuccesss": "Saved",
"app.submissionFailures.resolveTitle": "Resolve Failure",
"app.submissionFailures.title": "Submission Failures",
"app.submissionStatus.accepted": "Toto řešení bylo připnuto cvičícím.",
"app.submissions.testResultsTable.correctness": "Správnost odevzdaného řešení (rozhodnutí sudího)",
"app.submissions.testResultsTable.cpuTimeExplain": "Procesorový čas (celový čas využití CPU všech spuštěných vláken dohromady)",
"app.submissions.testResultsTable.exitCode": "Návratový kód (případně chybová hláška, pokud pro daný kód existuje)",
"app.submissions.testResultsTable.memoryExceeded": "Naměřená spotřeba paměti",
"app.submissions.testResultsTable.overallTestResult": "Celkové výsledky testu",
"app.submissions.testResultsTable.statusFailed": "Chyba",
"app.submissions.testResultsTable.statusOK": "OK",
"app.submissions.testResultsTable.statusSkipped": "Přeskočeno",
"app.submissions.testResultsTable.timeExceeded": "Naměřený čas spuštění",
"app.submissions.testResultsTable.wallTimeExplain": "Reálný čas (tzv. 'wall-time' měřený systémovými hodinami)",
"app.submissionsTable.commentsIcon.count": "Počet komentářů: {count}",
"app.submissionsTable.commentsIcon.last": "Poslední komentář: {last}",
"app.submissionsTable.environment": "Target language",
Expand Down
31 changes: 31 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"app.confirm.no": "No",
"app.confirm.yes": "Yes",
"app.createGroup.externalId": "External ID of the group (e. g. ID of the group in the school IS):",
"app.createGroup.hasThreshold": "Students require cetrain number of points to complete the course",
"app.createGroup.isPublic": "Students can join the group themselves",
"app.createGroup.publicStats": "Students can see statistics of each other",
"app.createGroup.threshold": "Minimum percent of the total points count needed to complete the course:",
Expand Down Expand Up @@ -375,6 +376,8 @@
"app.editSimpleLimitsField.tooltip.cloneHorizontal": "Copy this value horizontally to all environments of the test.",
"app.editSimpleLimitsField.tooltip.cloneVertical": "Copy this value vertically to all tests within the environment.",
"app.editSimpleLimitsForm.failed": "Cannot save the exercise limits. Please try again later.",
"app.editSimpleLimitsForm.preciseTime": "Precise Time Measurement",
"app.editSimpleLimitsForm.preciseTimeTooltip": "If precise time measurement is selected, ReCodEx will measure the consumed CPU time of tested soltions. Otherwise, the wall time will be measured. CPU is better in cases when serial time complexity of the solution is tested and tight time limits are set. Wall time is better in general cases as it better reflects the actual time consumed by the solution (indcluing I/O), but it is more susceptible to errors of measurement.",
"app.editSimpleLimitsForm.reset": "Reset",
"app.editSimpleLimitsForm.submit": "Save Limits",
"app.editSimpleLimitsForm.submitting": "Saving Limits ...",
Expand All @@ -397,9 +400,12 @@
"app.editTestsTest.remove": "Remove",
"app.editTestsTest.weight": "Test weight:",
"app.editUser.description": "Edit user's profile",
"app.editUser.makeLocal": "Create local account",
"app.editUser.title": "Edit user's profile",
"app.editUserProfile.degreesAfterName": "Degrees after name:",
"app.editUserProfile.degreesBeforeName": "Degrees before name:",
"app.editUserProfile.emptyLocalPassword": "Local account does not have a password",
"app.editUserProfile.emptyLocalPasswordExplain": "You may not sign in to ReCodEx using local account until you set the password.",
"app.editUserProfile.firstName": "First name:",
"app.editUserProfile.lastName": "Last name:",
"app.editUserProfile.passwordInstructions": "If you don't want to change your password leave these inputs blank",
Expand Down Expand Up @@ -627,6 +633,12 @@
"app.failedGroupDetail.msg": "Cannot load group detail. Please try again later.",
"app.failedSubmissionDetail.description": "Make sure you are connected to the Internet and repeat the action after a while.",
"app.failedSubmissionDetail.title": "Cannot load evaluation of the solution",
"app.failureList.headCreatedAt": "Created at",
"app.failureList.headDescription": "Description",
"app.failureList.headResolutionNote": "Resolution note",
"app.failureList.headResolvedAt": "Resolved at",
"app.failureList.headType": "Type",
"app.failureList.noFailures": "There are no failures in this list.",
"app.faq.description": "ReCodEx FAQ",
"app.faq.title": "FAQ",
"app.feedbackAndBugs.contribution": "If you are interested in frontend web development, feel free to fix the bug itself and send a pull request! Any help will be much appreciated!",
Expand Down Expand Up @@ -865,6 +877,7 @@
"app.referenceSolutionDetail.exercise": "Exercise",
"app.referenceSolutionDetail.refreshEvaluations": "Refresh",
"app.referenceSolutionDetail.resubmit": "Resubmit",
"app.referenceSolutionDetail.resubmitDebug": "Resubmit in Debug Mode",
"app.referenceSolutionDetail.title.details": "Reference solution detail",
"app.referenceSolutionDetail.uploadedAt": "Uploaded at:",
"app.referenceSolutionEvaluation.title": "Evaluations of reference solution",
Expand Down Expand Up @@ -918,6 +931,7 @@
"app.resultsTable.total": "Total",
"app.search.query": "Searched query: ",
"app.search.title": "Search:",
"app.sidebar.menu.admin.failures": "Submission Failures",
"app.sidebar.menu.admin.instances": "Instances",
"app.sidebar.menu.admin.users": "Users",
"app.sidebar.menu.createAccount": "Create account",
Expand Down Expand Up @@ -983,15 +997,32 @@
"app.submissionEvaluation.select": "Select",
"app.submissionEvaluation.selected": "Selected",
"app.submissionEvaluation.title": "Other submissions of this solution",
"app.submissionFailures.description": "Browse all submission failures",
"app.submissionFailures.failed": "Cannot load the list of failures",
"app.submissionFailures.failedDescription": "We are sorry for the inconvenience, please try again later.",
"app.submissionFailures.listTitle": "Submission Failures",
"app.submissionFailures.loading": "Loading list of failures ...",
"app.submissionFailures.loadingDescription": "Please wait while we are getting the list of failures ready.",
"app.submissionFailures.resolve": "Resolve",
"app.submissionFailures.resolveClose": "Close",
"app.submissionFailures.resolveMaxLengthExceeded": "Maximum length of the note exceeded.",
"app.submissionFailures.resolveNote": "Resolve note:",
"app.submissionFailures.resolveSave": "Save",
"app.submissionFailures.resolveSaving": "Saving ...",
"app.submissionFailures.resolveSuccesss": "Saved",
"app.submissionFailures.resolveTitle": "Resolve Failure",
"app.submissionFailures.title": "Submission Failures",
"app.submissionStatus.accepted": "This solution was marked by one of the supervisors as accepted.",
"app.submissions.testResultsTable.correctness": "Correctness of the result (verdict of the judge)",
"app.submissions.testResultsTable.cpuTimeExplain": "CPU time (total time the CPU was used by all threads)",
"app.submissions.testResultsTable.exitCode": "Exit code (possibly translated into error message if translation is available)",
"app.submissions.testResultsTable.memoryExceeded": "Measured memory utilization",
"app.submissions.testResultsTable.overallTestResult": "Overall test result",
"app.submissions.testResultsTable.statusFailed": "FAILED",
"app.submissions.testResultsTable.statusOK": "OK",
"app.submissions.testResultsTable.statusSkipped": "SKIPPED",
"app.submissions.testResultsTable.timeExceeded": "Measured execution time",
"app.submissions.testResultsTable.wallTimeExplain": "Wall time (real-time measured by external clock)",
"app.submissionsTable.commentsIcon.count": "Total Comments: {count}",
"app.submissionsTable.commentsIcon.last": "Last Comment: {last}",
"app.submissionsTable.environment": "Target language",
Expand Down

0 comments on commit bb1cc9a

Please sign in to comment.