Forum Discussion

adrian_hawryluk's avatar
5 years ago

Duplicate Routines entry/exit

I don't understand.  Why can I not Start profiling when entering a function and Stop profiling when exiting the same function?  I would think that this would be a very common thing to do.  For that matter, why is there a limit of only one anyway?  I can think of other use cases, such as where I'd want to stop and generate a report at the exiting of a function.  What's up with this? Why the limitation?

5 Replies

    • adrian_hawryluk's avatar

      Hi Alex,

      Yes, that is what I was attempting to do and I got the error message stating that I have duplicate routines.

      I've attached an image of an example.  The function I used is just one that I selected at random.

      • AlexKaras's avatar
        Champion Level 3



        error message stating that I have duplicate routines.

        I think this is expected.

        According to my understanding of the help topic (How Triggers Work paragraph):


        "When an on-trigger routine begins executing, it saves the current profiling status for its thread and enables profiling for that thread. This still applies to everything it calls. When it reaches the end of its execution (after perhaps hundreds of calls, sub-calls and sub-sub-calls), it restores the thread’s profiling status as it found it."


        So, I think that you should disable all profiling (like it is on the screenshot you've provided), then create the On-trigger and add the target routine to it and start profiling run.

        Profiling should start on function enter and stop on exit.


        Summarizing: Delete Off-trigger and do profiling run. I hope you should get desired result.