feat(debug): log execution time
This commit is contained in:
parent
64a7fc1144
commit
0c6ed73dde
2 changed files with 18 additions and 0 deletions
|
|
@ -278,6 +278,17 @@ function M.run_individual_tests(ctx, test_cases, contest_config, is_debug)
|
|||
})
|
||||
end
|
||||
|
||||
local passed = 0
|
||||
local total_time = 0
|
||||
for _, result in ipairs(results) do
|
||||
if result.status == "PASS" then
|
||||
passed = passed + 1
|
||||
end
|
||||
total_time = total_time + result.time_ms
|
||||
end
|
||||
|
||||
logger.log(("test results: %d/%d passed, total execution time %.1fms"):format(passed, #results, total_time))
|
||||
|
||||
return {
|
||||
compile_error = nil,
|
||||
results = results,
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ local function setup_problem(contest_id, problem_id)
|
|||
return
|
||||
end
|
||||
|
||||
local problem_name = state.platform == "cses" and contest_id or (contest_id .. (problem_id or ""))
|
||||
logger.log(("setting up problem: %s"):format(problem_name))
|
||||
|
||||
local metadata_result = scrape.scrape_contest_metadata(state.platform, contest_id)
|
||||
if not metadata_result.success then
|
||||
logger.log(
|
||||
|
|
@ -185,6 +188,8 @@ local function run_problem()
|
|||
return
|
||||
end
|
||||
|
||||
logger.log(("running problem: %s"):format(problem_id))
|
||||
|
||||
if config.hooks and config.hooks.before_run then
|
||||
config.hooks.before_run(problem_id)
|
||||
end
|
||||
|
|
@ -233,6 +238,8 @@ local function test_problem()
|
|||
return
|
||||
end
|
||||
|
||||
logger.log(("opening test viewer for problem: %s"):format(problem_id))
|
||||
|
||||
if not state.test_cases then
|
||||
logger.log("No test case data available. Try scraping the problem first.", vim.log.levels.ERROR)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue