mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-22 12:30:19 +00:00
Update profiler.cpp
This commit is contained in:
parent
e62f3a2e10
commit
c06bf5729c
@ -80,10 +80,14 @@ Str LineProfiler::stats(){
|
|||||||
const LineRecord& record = file_records.at(line);
|
const LineRecord& record = file_records.at(line);
|
||||||
if(!record.is_valid()) continue;
|
if(!record.is_valid()) continue;
|
||||||
ss << left_pad(std::to_string(line), 6);
|
ss << left_pad(std::to_string(line), 6);
|
||||||
ss << left_pad(std::to_string(record.hits), 10);
|
if(record.hits == 0){
|
||||||
ss << left_pad(std::to_string(record.time / CLOCKS_PER_SEC), 13);
|
ss << std::string(10 + 13 + 9 + 9, ' ');
|
||||||
ss << left_pad(std::to_string(record.time / record.hits), 9);
|
}else{
|
||||||
ss << left_pad(to_string_1f(record.time * (f64)100 / total_time), 9);
|
ss << left_pad(std::to_string(record.hits), 10);
|
||||||
|
ss << left_pad(std::to_string(record.time), 13);
|
||||||
|
ss << left_pad(std::to_string(record.time / record.hits), 9);
|
||||||
|
ss << left_pad(to_string_1f(record.time * (f64)100 / total_time), 9);
|
||||||
|
}
|
||||||
// line_content
|
// line_content
|
||||||
auto [_0, _1] = decl->code->src->_get_line(line);
|
auto [_0, _1] = decl->code->src->_get_line(line);
|
||||||
ss << " " << std::string_view(_0, _1-_0) << "\n";
|
ss << " " << std::string_view(_0, _1-_0) << "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user