mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Update line_profiler.c
This commit is contained in:
parent
2b7772d371
commit
abf96a7128
@ -87,9 +87,11 @@ c11_string* LineProfiler__get_report(LineProfiler* self) {
|
|||||||
c11_sbuf__write_quoted(&sbuf, src_name, '"');
|
c11_sbuf__write_quoted(&sbuf, src_name, '"');
|
||||||
c11_sbuf__write_cstr(&sbuf, ": [");
|
c11_sbuf__write_cstr(&sbuf, ": [");
|
||||||
LineRecord* lines = (LineRecord*)kv.value;
|
LineRecord* lines = (LineRecord*)kv.value;
|
||||||
|
bool is_first = true;
|
||||||
for(int j = 1; j < line_record_length; j++) {
|
for(int j = 1; j < line_record_length; j++) {
|
||||||
// [<j>, <hits>, <time>]
|
// [<j>, <hits>, <time>]
|
||||||
if(lines[j].hits == 0 && lines[j].time == 0) continue;
|
if(lines[j].hits == 0 && lines[j].time == 0) continue;
|
||||||
|
if(!is_first) c11_sbuf__write_cstr(&sbuf, ", ");
|
||||||
c11_sbuf__write_cstr(&sbuf, "[");
|
c11_sbuf__write_cstr(&sbuf, "[");
|
||||||
c11_sbuf__write_int(&sbuf, j);
|
c11_sbuf__write_int(&sbuf, j);
|
||||||
c11_sbuf__write_cstr(&sbuf, ", ");
|
c11_sbuf__write_cstr(&sbuf, ", ");
|
||||||
@ -97,7 +99,7 @@ c11_string* LineProfiler__get_report(LineProfiler* self) {
|
|||||||
c11_sbuf__write_cstr(&sbuf, ", ");
|
c11_sbuf__write_cstr(&sbuf, ", ");
|
||||||
c11_sbuf__write_i64(&sbuf, lines[j].time);
|
c11_sbuf__write_i64(&sbuf, lines[j].time);
|
||||||
c11_sbuf__write_cstr(&sbuf, "]");
|
c11_sbuf__write_cstr(&sbuf, "]");
|
||||||
if(j < line_record_length - 1) c11_sbuf__write_cstr(&sbuf, ", ");
|
is_first = false;
|
||||||
}
|
}
|
||||||
c11_sbuf__write_cstr(&sbuf, "]");
|
c11_sbuf__write_cstr(&sbuf, "]");
|
||||||
if(i < self->records.length - 1) c11_sbuf__write_cstr(&sbuf, ", ");
|
if(i < self->records.length - 1) c11_sbuf__write_cstr(&sbuf, ", ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user