Stackify is now BMC. Read theBlog

How to use Prefix to profile your own custom code

By: mwatson
  |  May 27, 2024
How to use Prefix to profile your own custom code

Today’s desktops and servers are amazingly fast. For most developers and apps, their actual code takes nearly ZERO time to execute. Almost all of the time is spent executing a database query, connecting to web service, etc. This is also why asynchronous programming is so important and has become so popular. Our goal with Prefix and the Stackify APM is to track all of the time that your app spends performing common operations.

Prefix is powered by profiling the .NET CLR. This enables us to do some pretty amazing things like automatically instrumenting and tracking the performance of dozens of common frameworks, including SQL queries, web service calls, logging, cache calls, queuing, and much more. However, Prefix & the Stackify APM, Retrace, will never be able to track the performance of everything; they both provide the ability for you to customize what methods are being tracked by our profiler.

Configuring custom profiling

The Stackify .NET profiler automatically profiles hundreds of methods. We provide a simple mechanism via a JSON file that you can create to specify additional custom methods. For example, let’s pretend that Prefix didn’t support tracking calls to Elasticsearch via the Nest library (it really does). Some simple JSON like this is all you would need to tell Prefix how to track this new method:

[{“Class”: “Nest.ElasticClient”, “Method”: “DoRequest”}]

You can also configure Prefix to track methods in your own projects and code. It is possible to use wildcards to track every class or method within a namespace even. Be careful though – tracking too many methods can bring your web server to a halt. Tracking something like System.* would instantly cause IIS to hang.

Video walkthrough

To learn even more, please watch this video:

Get Prefix Power on a server!
Get Prefix Power on a server!


Improve Your Code with Retrace APM

Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.

Learn More

Want to contribute to the Stackify blog?

If you would like to be a guest contributor to the Stackify blog please reach out to [email protected]