Kappa-Dev/KappaTools

abbreviated time print in snapshots

Closed this issue · 4 comments

Kappa formatted snapshots contain a print-out of the time, but is an abbreviated version. Is there a way of obtaining snapshots with the full time print-out? Ideally, something I can test against what is printed to the trace file (after serialization, both representations are strings).

feret commented

Dear @hmedina

I have put a proposition of fix in the branch fulltimestampinsnapshots.
Could you check that this is implementing what you are asking ?

If so, how to proceed ?

  • do we always want full time-stamp ?
  • do we want a parameter (with a command line option, a tunable option in the UI, some related directives) ?

I am open, let me know.

Hi Jérôme! Yes, I think that works (but now I KaTIE has to update its printer...)

I believe the current behavior is to only print 4 decimals. I think expanding to print the full string representation is a negligible cost (only about 9 extra characters from what I'm seeing on my snapshots, which are 14K characters long), and so should be the default behavior.

That said, if brevity is desired on other use-cases (test suite?), perhaps a user-defined parameter, something like:
%def: "snapshot-time-precision" int

Though at that point, I wonder if one could just specify a format via C-like strings (used also in Python):
T=23.123456
%def: "snapshot-time-format" {f.4} -> "T0" "23.1235"
%def: "snapshot-time-format" {e.2} -> "T0" "2.31e1"

feret commented

OK I merge then.
If someone prefers more compact pretty-printing I will implement the parameterization.
Before it was using the %g format (of C), now it is using the json float writing operator.

feret commented

Yes, it we add a parameter, C-like strings would be a good move.