Damian Mehers' Blog Evernote and Wearable devices. All opinions my own.

9Sep/083

TraceJS V2 R.I.P.

A couple of years ago I posted a small blog entry on a throwaway tool that I had created that uses the Debug API to log all JavaScript that Internet Explorer executes.

A year ago I decided to take a year off from consulting, mainly to spend a lot more time with our kids while they are still young, but also to have some time to explore some product ideas.

The first idea I wanted to explore was whether or not it might be possible to extend the idea I'd had in that older blog post to actually make a commercial product that would not only trace all JavaScript, but would also show call stacks, and show how often functions were executed.

Technically it was tricky because I wanted my custom JavaScript debugger to be loaded in-process into Internet Explorer, since I thought that this might speed it up considerably. The secret turned out to be that I needed to pass a special flag to IDebugProgramProvider2->GetProviderProcessData (the PFLAG_DEBUGGEE flag).

After a couple of months of development I finally got it all working.

You started it from the IE Tools menu:
image

This would create a separate TraceJS dialog: image

Then as you access a page that contains JavaScript the TraceJS Window shows the statements that are being executed:image image

Once you'd captured the JavaScript execution, you could replay the executed JavaScript, either step-by-step, or continually at a pace you define:image

Finally you could  drill-down to see which functions are called the most, and who calls them:image

I had it all working in my initial build environment, which was XP based.  Then I tested in Vista, and I couldn't get it to work  (the GetProviderProcessData failed).  Ouch!

I took a step back, gave the product a long hard look, and decided to stop development.  It was too slow (despite being entirely in-process), I couldn't implement features I needed such as timing (the debugging/tracing added too much overhead), and I couldn't get it working on Vista.

Now that IE8 has similar profiling features I'm happy I stopped when I did.

Of course the biggest mistake I made was to register the domain names for the product before it was completed (tracejs.com, jsprof.com, jsprofiler.com and javascriptprofiler.com are all mine).

If there is one sure way to kill a product idea it is to register domain names before you've executed on the product idea itself :-).

Filed under: Debugging Leave a comment
Comments (3) Trackbacks (0)
  1. Hi Damian!

    First of all – thank you for TraceJS, nice job! Almost every tracing software (if its used with real world apps, not just “Hello World!”) requires very complex algorithms and rich GUI to analyse huge amount of data, so it is no wonder you weren’t able to complete this task by yourself only. I know what I’m talking about – I worked hard several years developing some tracing software…

    Well, what do I want to ask?
    TraceJS works nice if there is a SCRIPT tag for appropriate code. But if IE is executing eval()`ed code – TraceJS displays nothing. And this is what makes me very sad, because most of Dojo’s script-code runs throuht eval(). I’m stuck with a mad IE problem somewhere between Dojo and GoogleMaps JS-api and TraceJS looks like my last hope.
    Is there any way to make TraceJS to trace eval()’ed code?
    Thanks!

    ps: could you please reply to the email I specified in the “Mail” form-field?

  2. Hi Damian,

    Can you share the code of the v2 that you created?

    It would be of great help to me

    Thanks in advance

  3. Hi,

    I am trying to use the IDebugProgramProvider2 in C#.

    I am unable to create an instance of the com object by using the ComInterop. I have searched for this Interface in the registry and tried creating an object of this, but was unable to create an instance.

    My Code is :
    [ComImport, Guid(“1959530A-8E53-4E09-AD11-1B7334811CAD”)]
    class DebugProgramProvider2Class
    {
    }

    All I get is a bunch of COM Errors.

    Can you please suggest me how I can about this? Alternatively, if you can share the V2 Code (I believe you have used this in there) it would help.

    -Thanks
    -Kiran


Leave a comment

No trackbacks yet.