Map of functions

rjframe dlang at ryanjframe.com
Fri Dec 14 17:45:26 UTC 2018


On Fri, 14 Dec 2018 16:33:44 +0000, Giovanni Di Maria wrote:

> 
> I need the flow of calls.
> Thank you Giovanni

gprof will do this on Linux/BSD if gdc supports the -pg flag (I don't know 
whether it would, but assume so) and your application is working.


>From code, you'd need to call a trace function on function entry. Mine 
lets you also specify a message (parameter values, etc.):

---
void trace(T...)(T args, string func = __FUNCTION__) {
    import std.stdio : writeln;
    if (args.length > 0) {
        debug writeln("*trace: ", func, "- ", args);
    } else {
        debug writeln("*trace: ", func);
    }
}

void main(int a, string b) {
    trace();
    trace(a, ", ", b);
}
---


More information about the Digitalmars-d-learn mailing list