profdump
profdump copied to clipboard
Error proding JSON output: "Cannot encode Infinity".
After compiling in profile mode, running the program, and then running profdump 0.4.3 on the resulting trace.log file, JSON output fails to be produced, although "dot" and "text" still function correctly.
For example, consider the following "trace.log" function "std.array.arrayAllocImpl":
------------------
16 _D3std5array__T18uninitializedArrayTAAyaTmZQBcFNaNbmZQr
_D3std5array__T14arrayAllocImplVbi0TAAyaTmZQBcFNaNbmZQr 16 7061 7061
------------------
1 _D3std5array__T18uninitializedArrayTAaTmZQBaFNaNbNemZQr
_D3std5array__T14arrayAllocImplVbi0TAaTmZQBaFNaNbmZQp 1 587 587
------------------
1 _D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTQBkZQrFQBqPQBvQBxZ9__lambda5VEQEeQDo18SortedRangeOptionsi0ZQEfZQFhFQEzZ9__lambda6MFNaNbNeZQEw
2 _D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTtZQpFQBoPtQBtZ9__lambda5VEQEaQDk18SortedRangeOptionsi0ZQEbZQFdFQEvZ9__lambda6MFNaNbNeZQEs
8 _D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTQBjZQrFQBqPQBuQBxZ9__lambda5VEQEeQDo18SortedRangeOptionsi0ZQEfZQFhFQEzZ9__lambda6MFNaNbNeZQEw
5 _D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTbZQpFQBoPbQBtZ9__lambda5VEQEaQDk18SortedRangeOptionsi0ZQEbZQFdFQEvZ9__lambda6MFNaNbNeZQEs
_D3std5array__T18uninitializedArrayTAAyaTmZQBcFNaNbmZQr 16 6870 -191
16 _D3std5array__T14arrayAllocImplVbi0TAAyaTmZQBcFNaNbmZQr
The profdump output in text mode is as follows:
Function 'immutable(..)[][] std.array.arrayAllocImpl!(..).arrayAllocImpl(..)':
Mangled name: '_D3std5array__T14arrayAllocImplVbi0TAAyaTmZQBcFNaNbmZQr'
Called by:
immutable(..)[][] std.array.uninitializedArray!(..).uninitializedArray(..) 16 times
Took: 0.007061 seconds (inf%)
Finished in: 0.007061 seconds (inf%)
Attempting to produce JSON output results in the following error:
Running ../../../.dub/packages/profdump-0.4.3/profdump/profdump -j trace.log profdump.json
std.json.JSONException@std/json.d(1806): Cannot encode Infinity. Consider passing the specialFloatLiterals flag.
----------------
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265dba]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong).emit!(immutable(char)[][]).emit(immutable(char)[][]) [0x5589a12666de]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265ad4]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265b9d]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong).emit!(immutable(char)[][]).emit(immutable(char)[][]) [0x5589a12666de]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265ad4]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions) [0x5589a1265951]
??:? @safe immutable(char)[] std.json.toJSON(ref const(std.json.JSONValue), in bool, in std.json.JSONOptions) [0x5589a1265717]
??:? const @safe immutable(char)[] std.json.JSONValue.toPrettyString(in std.json.JSONOptions) [0x5589a12656df]
../../../.dub/packages/profdump-0.4.3/profdump/source/profdump.d:164 const void profdump.Profile.writeJSON(ref std.stdio.File, in float, in bool) [0x5589a120dcb4]
../../../.dub/packages/profdump-0.4.3/profdump/source/app.d:103 _Dmain [0x5589a11ad36e]
The output of "inf%" is unexpected as well as the error when trying to produce output in JSON.