Skip to content

Commit

Permalink
Show execution duration
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Aug 18, 2024
1 parent c566d8e commit f321f0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion glot_core/src/page/snippet_page/output_panel.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::time::Duration;

use crate::run::FailedRunResult;
use crate::run::RunResult;
use crate::util::remote_data::RemoteData;
Expand Down Expand Up @@ -62,10 +64,13 @@ fn view_info(text: &str) -> Markup {
}

fn view_run_result(run_result: &RunResult) -> Markup {
let duration = format!("{:.2?}", Duration::from_nanos(run_result.duration));

html! {
@if !run_result.stdout.is_empty() {
dt class="px-4 py-1 border-t border-b border-gray-400 text-sm text-slate-700 font-bold bg-green-400" {
dt class="px-4 py-1 flex justify-between border-t border-b border-gray-400 text-sm text-slate-700 font-bold bg-green-400" {
pre { "STDOUT" }
pre { (duration) }
}
dd class="px-4 py-2 overflow-y-auto" {
pre {
Expand Down
1 change: 1 addition & 0 deletions glot_core/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct RunRequest {
#[derive(Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RunResult {
pub duration: u64,
pub stdout: String,
pub stderr: String,
pub error: String,
Expand Down

0 comments on commit f321f0e

Please sign in to comment.