digitalmars.D.bugs - [Issue 4708] New: expose rt.trace and rt.cover api's
- d-bugmail puremagic.com (27/27) Aug 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4708
- d-bugmail puremagic.com (51/51) Aug 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4708
- d-bugmail puremagic.com (30/30) Aug 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4708
http://d.puremagic.com/issues/show_bug.cgi?id=4708
Summary: expose rt.trace and rt.cover api's
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: druntime
AssignedTo: sean invisibleduck.org
ReportedBy: braddr puremagic.com
---
The dmd test suite has a few tests that run -profile and -cov. Right now,
those all output to the same filename with no non-hacky way of getting to those
apis.
They're extern(C)'ed, so they can be forced with repeating the extern
declaration where needed, but that's awfully ugly.
Food for thought.. could the defaults be better? What's the definition of
better?
Right now, both default to the current directory. Trace defaults to
'trace.log' and 'trace.def'. Cover defaults to sourcefile.lst, if I read the
code correctly.
Maybe this would be a good place for some env vars to influence the two?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4708
---
Merely adding the calls to set the trace log files is enough to cause the files
to be created, even without -cov. This is due to the calls being enough to
drag in the module and it's shared this/~this are invoked.
Also, for a simple test case, no trace results other than the file headers are
being produced:
module hello;
extern(C)
{
int printf(const char*, ...);
int trace_setlogfilename(string name);
int trace_setdeffilename(string name);
}
void showargs(char[][] args)
{
printf("hello world\n");
printf("args.length = %d\n", args.length);
for (int i = 0; i < args.length; i++)
printf("args[%d] = '%s'\n", i, cast(char *)args[i]);
}
int main(char[][] args)
{
trace_setlogfilename("test_results/runnable/hello-profile.d.trace.log");
trace_setdeffilename("test_results/runnable/hello-profile.d.trace.def");
showargs(args);
return 0;
}
Results in:
::::::::::::::
test_results/runnable/hello-profile.d.out
::::::::::::::
../src/dmd -Irunnable -cov -od./test_results/runnable
-of./test_results/runnable/hello-profile runnable/hello-profile.d
./test_results/runnable/hello-profile
hello world
args.length = 1
args[0] = './test_results/runnable/hello-profile'
::::::::::::::
test_results/runnable/hello-profile.d.trace.def
::::::::::::::
FUNCTIONS
::::::::::::::
test_results/runnable/hello-profile.d.trace.log
::::::::::::::
======== Timer Is 3579545 Ticks/Sec, Times are in Microsecs ========
Num Tree Func Per
Calls Time Time Call
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4708
---
course, that just further outlines the problems caused by having the two result
files generated with just the column headers merely by setting the destination
file names. Compiling with -profile and running the sample code below produces
the two files as expected:
::::::::::::::
test_results/runnable/hello-profile.d.trace.def
::::::::::::::
FUNCTIONS
_Dmain
_D5hello8showargsFAAaZv
::::::::::::::
test_results/runnable/hello-profile.d.trace.log
::::::::::::::
------------------
1 _Dmain
_D5hello8showargsFAAaZv 1 141436 141436
------------------
_Dmain 0 142088 652
1 _D5hello8showargsFAAaZv
======== Timer Is 3579545 Ticks/Sec, Times are in Microsecs ========
Num Tree Func Per
Calls Time Time Call
1 39512 39512 39512 _D5hello8showargsFAAaZv
1 39694 182 182 _Dmain
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 22 2010









d-bugmail puremagic.com 