Error Problem with SessionTrace

Rob Fitzpatrick

ProgressTalk.com Sponsor
OK, now in a new session it's just giving me an empty HTML table for Code Timing.

The pattern of lights is all wrong... Refilling my coffee...
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
I think this is the relevant code in the PUT statement in the WriteHTML method:

Code:
'<td>' STRING(ttSnapLineSummary.TotalTime / 1000,">>>,>>>,>>>,>>9.9999999") '</td>'
'<td>' STRING(ttSnapLineSummary.TotalTime,">>>,>>>,>>>,>>9.9999999") '</td>'
 

TheMadDBA

Active Member
Thanks... I am in the process of changing all of the TT columns to say MS or Seconds instead of time and getting rid of all the calculations that are happening in the GUI/HTML side.

Looks like I had a slightly different version than the last upload on my PC. I need to implement some kind of version number in the various programs and get my SVN server going again.
 

Cringer

ProgressTalk.com Moderator
Staff member
Still fighting over control over the domain name from my horrible hosting provider... ugh. I think a new domain is in order until that gets resolved....

Looks like some of the timing displays are messed up in the HTML/GUI side (new versions should correct this I hope).
You can grab it again from http://themaddba.s3-website-us-west-2.amazonaws.com/dlmain.html

Some sample code from the website....

Code:
/*--- Use the profiler to gather detailed line timings ---*/
SessionTrace:UseProfiler = TRUE.

/*--- Start the tracing session ---*/
SessionTrace:StartTracing().

/*--- Read the state table ---*/
  FOR EACH state NO-LOCK:
  END.

/*--- Make a snapshot to track this section separately ---*/
SessionTrace:StartSnapshot("Order and order-line section").

/*--- Read more data in a bad way ---*/
FOR EACH order WHERE order.cust-num <> 1000 NO-LOCK,
  EACH order-line OF order NO-LOCK,
  EACH ITEM OF order-line NO-LOCK
  BREAK BY ITEM.item-name DESCENDING:
END.

/*--- Stop the tracing ---*/
SessionTrace:StopTracing().

/*--- Write the data out in HTML format ---*/
SessionTrace:WriteHTML("MySession.html").

/*--- Write the data out in text format for the GUI tool to load ---*/
SessionTrace:WriteText("MySession.txt").

Love it! Got it working in my application. I really do like the VST stuff. Question - is it tied to the user logged on, or is it across the DB as a whole?
We have a global hotkey for profiling and am considering replacing it with this (if that's ok with you), but it's no use if it's CRUD for the whole DB.

One thing I do like is it gives CRUD for al DBs connected!
 

TheMadDBA

Active Member
It uses the _UserTableStat and _UserIndexStat VSTs so it is only for the session that executes the code. Before I put it into production I would do a little testing to make sure everything is getting cleaned up like it should, but feel free to use it as you see fit.

Still working on the UI and debugging as I can... I should have a new release ready soon that supports sorting the browses, moving and re-sizing the browses and saving the options so it persists between sessions. Working on adding the ability to import and saving the record counts per table so it can support percentage of table read/updated/etc.
 

Cringer

ProgressTalk.com Moderator
Staff member
Good stuff. One thing I think I've noticed is that the first time you run it in a session it includes some CRUD data that wasn't part of the snapshot, ie happens before the snapshot is started. I've not really tested it, but some of the tables read don't make a huge amount of sense to me.

Actually I've retested and yes something is up. These 2 files attached are for the same action. I enable tracing, run the program, stop tracing. As you can see the first one has references to stuff the second doesn't. The code is identical.

Code for enabling/disabling

Code:
ON "CTRL-ALT-F12":U ANYWHERE
  DO:
    IF NOT lv-SessionTrace THEN 
    DO:
      /*--- Use the profiler to gather detailed line timings ---*/
      SessionTrace:UseProfiler = TRUE.

      /*--- Start the tracing session ---*/
      SessionTrace:StartTracing().

      /*--- Make a snapshot to track this section separately ---*/
      SessionTrace:StartSnapshot("ICMAS Stuff").
      lv-SessionTrace = TRUE.
      MESSAGE "Session Trace On"
        VIEW-AS ALERT-BOX.
     
    END. 
    ELSE 
    DO:
      /*--- Stop the tracing ---*/
      SessionTrace:StopTracing().

      /*--- Write the data out in HTML format ---*/
      SessionTrace:WriteHTML(SESSION:TEMP-DIRECTORY + "MySession.html").

      /*--- Write the data out in text format for the GUI tool to load ---*/
      SessionTrace:WriteText(SESSION:TEMP-DIRECTORY + "MySession.txt").
      lv-SessionTrace = FALSE.
      MESSAGE "Session Trace Off"
        VIEW-AS ALERT-BOX.
    END. 
  /*  PROFILER:ENABLED = NOT PROFILER:ENABLED.                                 */
  /*  PROFILER:PROFILING = PROFILER:ENABLED.                                   */
  /*  PROFILER:LISTINGS = TRUE.                                                */
  /*  IF PROFILER:ENABLED THEN                                                 */
  /*    lv-ProfileFile = SESSION:TEMP-DIRECTORY + STRING(TIME) + "profile.out".*/
  /*  MESSAGE "Profiler is" STRING(PROFILER:ENABLED,"ON/OFF")                  */
  /*    SKIP "File Name:" lv-ProfileFile                                       */
  /*    VIEW-AS ALERT-BOX.                                                     */
  /*  PROFILER:FILE-NAME = lv-ProfileFile.                                     */
  END.
 

Attachments

  • MySession1.txt
    78.6 KB · Views: 2
  • MySession2.txt
    71.9 KB · Views: 1

TheMadDBA

Active Member
The biggest difference I can see is the lack of reads from the SECURE database. Are you 100% sure the database is connected before StartTracing is called?

Also is there any caching built in so it doesn't have to read the security setup twice?
 

Cringer

ProgressTalk.com Moderator
Staff member
You could be right. I've just gone back to the code and the preprocessing going on is a nightmare hurting my brain.

One thought I have, is there a way you could have an option to say "This is a single user database so please use _TableStat and _IndexStat rather than the _User* tables? I have a lot of code in my application that fires off to AppServers, and I don't have a simple mechanism in place in the application for asking it to stay in the session. That means I lose all CRUD info for the actual query. If I could optionally say run at DB level rather than session then I could still get the CRUD info.
 

Cringer

ProgressTalk.com Moderator
Staff member
It's single user but with AppServer, so the queries that run on the AppServer are under a different user.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
It's single user but with AppServer, so the queries that run on the AppServer are under a different user.
I don't understand. Do you mean that your session has _Connect-usr = 0 on this single-user database and _Connect-usr = x (where x <> 0) on another connected database? That can always be the case, whether or not the database was started single-user. And it can apply to any database client, so it shouldn't matter that it's AppServer.

When working with multiple databases you have to look at _MyConnection in each one and join it to the user-specific VSTs you want to read.
 

Cringer

ProgressTalk.com Moderator
Staff member
Ah sorry my misuse of terminology. When I say single user I mean I'm the only one connected. The database is served locally with AppServer running.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Ah sorry my misuse of terminology. When I say single user I mean I'm the only one connected.
OK. But I'm still not following why you need _TableStat/_IndexStat data instead of _UserTableStat/_UserIndexStat data.

Is it because there are multiple stateless agents and each request may be served by a different one?
 

TheMadDBA

Active Member
I would suspect he needs the _TableStat/_IndexStat for that very reason. He has a client server session that is being traced, but it is also making appserver calls that are running as different connections.

I can add the switch rather easily but it would only be able to track the table and index activity. I would need to do a lot more work to implement and merge the profiler tracing between numerous clients.
 

Cringer

ProgressTalk.com Moderator
Staff member
Thanks MadDBA. Yes that's what's going on. We have selector screens where the where the filters selected are sent to the asynch appserver. The results are then presented back to the user. I'm not too bothered about merging session trace info from the AppServer side. In most cases the code doesn't do much more than build a query string and a temp table from the resulting query and return it, so it's not hard to trace where it goes. The CRUD information though is really interesting to me as I can sell this as a tool to the team for determining performance issues. It saves me having to show newbies two or even three tools :D
 

TheMadDBA

Active Member
New version available that supports using the database level VSTs (preference option), column sorting, custom layouts that can include multiple windows and custom lists of fields to display (with label, font and format overrides).

There are probably a few issues here and there. Still have to find the time to integrate some of the DB info like record counts but it should be a little easier to deal with than the previous version.

http://practicaldba.com/downloads/apptune/OETools.zip
 

Cringer

ProgressTalk.com Moderator
Staff member
I've currently just got SessionTrace.cls and TraceMain.w in my application. Can I get away with just those still? Or what's the bare minimum I have to install for a working system (mostly interested in the output generation and the .w for parsing the output).
 

TheMadDBA

Active Member
For the tracing you will just need a compiled version of SessionTrace.cls.

For the UI you would have to include quite a bit more I am afraid.

I guess I am wondering why the UI itself would be merged into your application unless you are expecting the end users to use the UI tool.
 

Cringer

ProgressTalk.com Moderator
Staff member
Good question on the UI. It's more for ease of use for the developers.
 
Top