Project

Profile

Help

SaxonC API: How to set argument "-TP:profile.html" via C/C++ API

Added by Andreas Oetjen 6 months ago

The "translate" command line provides writing a timing profile file using argument -TP:profile.html But I coudn't find out how to do this using the Saxon.C.API: I tried:

        SaxonProcessor* processor = new SaxonProcessor(false);
        processor->setConfigurationProperty("http://saxon.sf.net/feature/traceListenerClass", "net.sf.saxon.trace.TimingTraceListener");
        processor->setConfigurationProperty("http://saxon.sf.net/feature/traceListenerOutputFile", "c:\\temp\\profile.html");
        processor->setConfigurationProperty("http://saxon.sf.net/feature/timing", "1");

in multiple combinations. Even

        processor->setConfigurationProperty("-TP", "profile.html");

Nothing seems to work.

What do I do wrong?


Replies (7)

Please register to reply

RE: SaxonC API: How to set argument "-TP:profile.html" via C/C++ API - Added by Martin Honnen 6 months ago

The Java code for the Transform class processing the -TP:filename command line option is at https://saxonica.plan.io/projects/saxonmirrorhe/repository/he/revisions/he_mirror_saxon_12_4/entry/src/main/java/net/sf/saxon/Transform.java#L551, I am not sure whether the same can be done from the SaxonC API. I think the traceListenerOutputFile is different from the profiling output file.

RE: SaxonC API: How to set argument "-TP:profile.html" via C/C++ API - Added by Martin Honnen 6 months ago

I have tested the properties your C++ code sets from the Java API of Saxon Java and there it seems a trace listener output file looking very much like a profile file is being created.

So ignore my comment that the traceListenerOutputFile is different from a profiling output file.

Unfortunately your question about SaxonC has ended up in the Saxon Java forum, let's wait to see whether O'Neil from Saxonica is around and moves this thread and can give you an answer.

RE: SaxonC API: How to set argument "-TP:profile.html" via C/C++ API - Added by O'Neil Delpratt 6 months ago

Thanks for reporting the problem. This feature is not well tested in SaxonC. We will investigate this further.

I have created the following bug issue under the SaxonC project; #6451

just to mention, the SaxonC command-line tool worked for me in producing the html file.

See example:

./transform -xsl:../samples/data/test.xsl -s:../samples/data/cat.xml -TP:profile.html

So I have to debug what is going wrong via the API.

RE: SaxonC API: How to set argument "-TP:profile.html" via C/C++ API - Added by Michael Kay 6 months ago

The code that produces the -TP output is largely in the net.sf.saxon.Transform class which supports the command line interface and is not directly available from any API, either in SaxonC or in SaxonJ. It does make use of underlying APIs and you could attempt to reconstruct what it does at the application level. You can find the code at

https://saxonica.plan.io/projects/saxondev/repository/26/revisions/saxon12/entry/src/main/java/net/sf/saxon/Transform.java

See lines 559 to 581.

The three main steps are:

  • Compiling the stylesheet with a TimingTraceInjector
  • Executing the stylesheet with a TimingTraceListener
  • Formatting the collected data with a stylesheet; the default stylesheet is at

https://saxonica.plan.io/projects/saxondev/repository/26/revisions/saxon12/entry/src/main/resources/net/sf/saxon/data/profile.xsl

RE: SaxonC API: How to set argument "-TP:profile.html" via C/C++ API - Added by Andreas Oetjen 6 months ago

Thank you for your response. Unfortunaltely, I get a 403 when accessing the link to the profile.xml

RE: SaxonC API: How to set argument "-TP:profile.html" via C/C++ API - Added by Michael Kay 6 months ago

Apologies for sending the wrong link. Thanks Martin for correcting it. Similarly the link to the latest version of the Transform class should be

https://saxonica.plan.io/projects/saxonmirrorhe/repository/he/revisions/34f7094cc6bae617fa257ecd148ad94394bd13a9/entry/src/main/java/net/sf/saxon/Transform.java

and the relevant code is at line 549

    (1-7/7)

    Please register to reply