February 12, 2021
On 2/9/21 12:45 AM, JG wrote:
> I was trying to profile a d program. So I ran: dub build --build=profile. I then ran the program and it produced trace.log and trace.def. I then ran d-profile-viewer and got the following error:
> 
> std.conv.ConvException@/home/jg/dlang/ldc-1.24.0/bin/../import/std/conv.d(2382): Unexpected '-' when converting from type char[] to type ulong
> ----------------
> ??:? [0x564a8630fda5]
> ??:? [0x564a86333286]
> ??:? [0x564a863199fd]
> /home/jg/dlang/ldc-1.24.0/bin/../import/std/conv.d:2382 [0x564a862c89a1]
> /home/jg/dlang/ldc-1.24.0/bin/../import/std/conv.d:1941 [0x564a862c86cc]
> /home/jg/dlang/ldc-1.24.0/bin/../import/std/conv.d:223 [0x564a862c869c]
> app.d:1095 [0x564a862cdd71]
> app.d:1138 [0x564a862ce7ba]
> ??:? [0x564a863196cb]
> ??:? [0x564a863195c7]
> ??:? [0x564a8631941d]
> /home/jg/dlang/ldc-1.24.0/bin/../import/core/internal/entrypoint.d:42 [0x564a862ce7e4]
> ??:? __libc_start_main [0x7fd482807cb1]
> 
> Is d-profile-viewer no longer working? Or did I do something wrong?

Speaking of D profile viewer [1] we had good luck with it after fixing the missing timestamps in the profile (I think on Linux platforms it cannot actually measure times and so we had to rewrite the profile file to generate some fake timestamp(s) or timings -- hazy on details).

Anyway, if you can get it working it was a nice callgraph tool


[1] https://bitbucket.org/andrewtrotman/d-profile-viewer/src/master/
August 24, 2021
On Wednesday, 10 February 2021 at 23:42:31 UTC, mw wrote:
> On Wednesday, 10 February 2021 at 11:52:51 UTC, JG wrote:
>>
>> As a follow up question I would like to know what tool people use to profile d programs?
>
> I use this one:
>
> https://code.dlang.org/packages/profdump
>
> e.g.
>
> ```
> dub build --build=debug --build=profile
>
> # run your program to generate trace.log
>
> profdump -b trace.log trace.log.b
> profdump -f --dot --threshold 1 trace.log trace.log.dot
> echo 'view it with: xdot trace.log.dot'
> ```

I tried to do this, but I am not sure how to install profdump.
What I did is cloned the repository using git.
Tried to build it using dub but got an error as described here:

https://github.com/AntonMeep/profdump/issues/6

I then modified the dub.json and got it to build but it only
produced a library. So I modified the dub.json again to tell
it to build an executable and got:

core.exception.AssertError@source/app.d(4): TODO
----------------
??:? [0x561af7b38025]
??:? [0x561af7b39aa6]
??:? [0x561af7b1cd8f]
??:? [0x561af7b15469]
app.d:4 [0x561af7aebc62]
??:? [0x561af7b1ca7b]
??:? [0x561af7b1c977]
??:? [0x561af7b1c7cd]
/home/james/dlang/ldc-1.26.0/bin/../import/core/internal/entrypoint.d:42 [0x561af7aebc94]
??:? __libc_start_main [0x7f5ba99accb1]
??:? [0x561af7aeb62d]
Program exited with code 1

I then looked inside source/app.d and found:

version(unittest) {

} else {
	void main() { assert(0, "TODO"); }
}


How does one install profdump?



August 24, 2021
On Tuesday, 24 August 2021 at 09:36:06 UTC, JG wrote:
> On Wednesday, 10 February 2021 at 23:42:31 UTC, mw wrote:
>> [...]
>
> I tried to do this, but I am not sure how to install profdump.
> What I did is cloned the repository using git.
> Tried to build it using dub but got an error as described here:
>
> [...]

In case anyone is interested it seems that it was forked to here:

https://github.com/joakim-brannstrom/profdump

Perhaps the dub page could be updated?
August 24, 2021
On Tuesday, 24 August 2021 at 09:42:29 UTC, JG wrote:
> On Tuesday, 24 August 2021 at 09:36:06 UTC, JG wrote:
>> On Wednesday, 10 February 2021 at 23:42:31 UTC, mw wrote:
>>> [...]
>>
>> I tried to do this, but I am not sure how to install profdump.
>> What I did is cloned the repository using git.
>> Tried to build it using dub but got an error as described here:
>>
>> [...]
>
> In case anyone is interested it seems that it was forked to here:
>
> https://github.com/joakim-brannstrom/profdump
>
> Perhaps the dub page could be updated?

Tried to continue following the instructions.
Ran:
profdump -b trace.log trace.log.b
Got:
core.exception.RangeError@source/app.d(134): Range violation
----------------
??:? [0x557458c2bad5]
??:? [0x557458c2d556]
??:? [0x557458c147af]
??:? [0x557458c0b458]
??:? [0x557458c0bb47]
app.d:133 [0x557458b96199]
??:? [0x557458c1449b]
??:? [0x557458c14397]
??:? [0x557458c141ed]
/home/jg/dlang/ldc-1.26.0/bin/../import/core/internal/entrypoint.d:42 [0x557458b979d4]
??:? __libc_start_main [0x7f0f84d39cb1]
??:? [0x557458b4a0cd]
August 24, 2021
On Tuesday, 24 August 2021 at 09:45:31 UTC, JG wrote:
> On Tuesday, 24 August 2021 at 09:42:29 UTC, JG wrote:
>> On Tuesday, 24 August 2021 at 09:36:06 UTC, JG wrote:
>>> [...]
>>
>> In case anyone is interested it seems that it was forked to here:
>>
>> https://github.com/joakim-brannstrom/profdump
>>
>> Perhaps the dub page could be updated?
>
> Tried to continue following the instructions.
> Ran:
> profdump -b trace.log trace.log.b
> Got:
> core.exception.RangeError@source/app.d(134): Range violation
> ----------------
> ??:? [0x557458c2bad5]
> ??:? [0x557458c2d556]
> ??:? [0x557458c147af]
> ??:? [0x557458c0b458]
> ??:? [0x557458c0bb47]
> app.d:133 [0x557458b96199]
> ??:? [0x557458c1449b]
> ??:? [0x557458c14397]
> ??:? [0x557458c141ed]
> /home/jg/dlang/ldc-1.26.0/bin/../import/core/internal/entrypoint.d:42 [0x557458b979d4]
> ??:? __libc_start_main [0x7f0f84d39cb1]
> ??:? [0x557458b4a0cd]

The reason for the crash boils down to the fact that this fails:

foreach(k; sort!"a > b"(funcs.keys)) assert(k in funcs);

funcs is of type ubyte[4][float]

Is this a compiler bug?
August 25, 2021

On Tuesday, 24 August 2021 at 10:33:07 UTC, JG wrote:

>

The reason for the crash boils down to the fact that this fails:

foreach(k; sort!"a > b"(funcs.keys)) assert(k in funcs);

funcs is of type ubyte[4][float]

Is this a compiler bug?

That assert will fail if there are NaN keys in the AA. This for example will print null:

bool[float] aa;
aa[float.nan] = true;
writeln(float.nan in aa);

Sort may also act funny when NaNs are involved, not sure about that.

1 2
Next ›   Last »