[m-rev.] for review: update stream line numbers when reporting statistics
Zoltan Somogyi
zoltan.somogyi at runbox.com
Sun Apr 4 13:16:51 AEST 2021
On Sun, 4 Apr 2021 00:54:10 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
> :- pragma foreign_proc("C#",
> - report_stats,
> + do_report_stats(Stream::in),
> [may_call_mercury, terminates],
> "
> - ML_report_standard_stats(io.mercury_stderr);
> + ML_report_standard_stats(Stream.F1);
> ").
I don't know what the .F1 here accomplishes; it certainly deserves
a comment.
> :- pragma foreign_proc("Java",
> - report_stats,
> + do_report_stats(Stream::in),
> [may_call_mercury, terminates],
> "
> - ML_report_standard_stats(io.mercury_stderr);
> + ML_report_standard_stats((io.MR_TextOutputFile) Stream.F1);
> ").
Likewise, and the cast deserves a comment too.
> @@ -67,7 +67,7 @@
> #endif // MR_MPROF_PROFILE_MEMORY
>
> void
> -MR_report_standard_stats(FILE *fp)
> +MR_report_standard_stats(FILE *fp, int *line_number)
> {
> int user_time_at_prev_stat;
> int real_time_at_prev_stat;
> @@ -153,11 +153,13 @@ MR_report_standard_stats(FILE *fp)
> GC_get_bytes_since_gc() / 1024.0,
> GC_get_heap_size() / 1024.0
> );
> + (*line_number)++;
I didn't check for a one-to-one correspondence between lines printed
and increments of *line_number, but I expect you did.
I presume that the reason why the Java and C# code for printing stats
has no similar increments is that the output methods they invoke do
the increment at each newline already. If that is right, then the diff
is otherwise fine. And thanks.
Zoltan.
More information about the reviews
mailing list