Friday, May 21, 2010

Getting started with tracing

Install the trace parser

Set up the server to capture tracing

1. Go to your server configuration in administrative tools.

2. Manage > Create configuration, give it a name, ok

3. Tracing tab:

Check X++ method calls

Check Function calls, Check the 'Sql Statement', 'Bind Variables'

Set number of nested calls to 99

Check Allow client tracing on AOS instance

4. Hit Apply

5. Hit OK

6. Go to your Client configuration in administrative tools.

7. Manage > Create configuration, give it a name, ok

8. Tracing tab:

Check X++ method calls

Check Function calls

Set number of nested calls to 99

9. Hit Apply

10. Hit OK.

11. Restart your AOS.

12. Re-launch your Client configuration screen.



Capture a trace

1. Launch your client as 'Administrator' by righ clicking and perform the action you want to trace once without tracing on (to warm up the caches)

2. In the client config click on "Start tracing"

3. Walk the action you want to trace again.

4. In the Client config click on "Stop tracing".

5. Go to the directory specified at the top of the tracing tab in the server config and sort by modified date. The most recent file should be a .trc file.



Analyze the trace

1. Start the trace parser. If it’s the first time you run it, you’ll be asked a bunch of questions. Be agreeable.

2. File > Import, pick that .trc files you just captured.

3. Start analyzing



I normally first go to the X++/RPC tab and filter by type, totals. Sort by Exclusive RPC calls first, see what’s causing issues. Then sort by inclusive RPC calls and see what’s causing issues. Then Exclusive duration, inclusive duration, etc. General rule of thumb is if you see “your code” in the top couple pages of data for any of those things, you should work to make it better. You can jump to the call stacks causing the calls and stuff. Just look for random ways to make your stuff faster, pull from caches instead of doing round trips, cut down on how many times you’re called, etc. No real science to it, just look for crappy stuff and fix it.



If you want to trace the client it’s the exact same thing, only use the client config instead.



If it doesn’t work

· Make sure you have at least 20 gig of free space on the drive where your log files are located. ETW doesn’t like to run with less than that.

· Make sure you restarted the client or AOS after setting up the tracing options.

· Make sure you wait about 15 seconds after you click “start trace” before you start doing stuff. It takes a couple seconds (usually about 5) before the tracing turns on.

No comments: