mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
some fix
This commit is contained in:
parent
f2ce3c97d7
commit
23cbc25487
@ -8,7 +8,7 @@ static std::string left_pad(std::string s, int width){
|
|||||||
return std::string(n, ' ') + s;
|
return std::string(n, ' ') + s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string to_string_1f(double x){
|
static std::string to_string_1f(f64 x){
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf(buf, 32, "%.1f", x);
|
snprintf(buf, 32, "%.1f", x);
|
||||||
return buf;
|
return buf;
|
||||||
@ -64,7 +64,7 @@ Str LineProfiler::stats(){
|
|||||||
for(auto& [line, record] : file_records){
|
for(auto& [line, record] : file_records){
|
||||||
total_time += record.time;
|
total_time += record.time;
|
||||||
}
|
}
|
||||||
ss << "Total time: " << (double)total_time / CLOCKS_PER_SEC << "s\n";
|
ss << "Total time: " << (f64)total_time / CLOCKS_PER_SEC << "s\n";
|
||||||
ss << "File: " << filename << "\n";
|
ss << "File: " << filename << "\n";
|
||||||
// ss << "Function: " << "<?>" << "at line " << -1 << "\n";
|
// ss << "Function: " << "<?>" << "at line " << -1 << "\n";
|
||||||
ss << "Line # Hits Time Per Hit % Time Line Contents\n";
|
ss << "Line # Hits Time Per Hit % Time Line Contents\n";
|
||||||
@ -74,7 +74,7 @@ Str LineProfiler::stats(){
|
|||||||
ss << left_pad(std::to_string(record.hits), 10);
|
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), 13);
|
||||||
ss << left_pad(std::to_string(record.time_per_hit()), 9);
|
ss << left_pad(std::to_string(record.time_per_hit()), 9);
|
||||||
ss << left_pad(to_string_1f(record.time * 100.0 / total_time), 9);
|
ss << left_pad(to_string_1f(record.time * (f64)100 / total_time), 9);
|
||||||
ss << " " << record.line_content() << "\n";
|
ss << " " << record.line_content() << "\n";
|
||||||
}
|
}
|
||||||
ss << "\n";
|
ss << "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user