runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Profiling API

Open gregoryyoung opened this issue 11 years ago • 79 comments

Is there any timeframe on a profiling API? Are there any public design docs available at this point?

Greg

gregoryyoung avatar Mar 14 '15 20:03 gregoryyoung

ICorProfiler profiling APIs are available in CoreCLR (on Windows, on Unix - not yet). They work same as in the full .NET Framework. The main difference is that the environment variables to setup the profiler have CoreClr_ prefix to avoid colliding with the full .NET Framework (ie CORECLR_ENABLE_PROFILING, CORECLR_PROFILER_PATH for CoreCLR vs. COR_ENABLE_PROFILING, COR_PROFILER_PATH for full .NET Framework).

Are you looking for anything particular?

jkotas avatar Mar 15 '15 04:03 jkotas

Do you know why *_PROFILER_PATH doesn't come in 32 and 64 bit versions - it limits this feature as the processes being profiled could be a combination of both but you can only register one.

sawilde avatar Mar 15 '15 23:03 sawilde

32-bit vs. 64-bit profiler path: It is a good suggestion. Could you please open a separate issue for it?

jkotas avatar Mar 16 '15 04:03 jkotas

I've opened dotnet/coreclr#601 to track the suggestion by @sawilde.

@gregoryyoung do you have enough information or are there other specific's you'd like?

MattWhilden avatar Mar 31 '15 11:03 MattWhilden

Alright, I'm closing this down. Let me know if that was in error.

MattWhilden avatar Apr 04 '15 05:04 MattWhilden

@jkotas You mention that the Profiling API is already available on Windows, but not yet on Unix. Is it the plan to provide this API (or something similar) on all platforms in the future?

If I am not mistaken, this API is what the guys over at NewRelic are missing in order to instrument .NET apps on non-Windows hosts. For reference: https://docs.newrelic.com/docs/agents/net-agent/getting-started/new-relic-net#app-frameworks

schourode avatar Jun 04 '15 14:06 schourode

We are basically in the same boat.

On Thu, Jun 4, 2015 at 5:03 PM, Jørn Schou-Rode [email protected] wrote:

@jkotas https://github.com/jkotas You mention that the Profiling API is already available on Windows, but not yet on Unix. Is it the plan to provide this API (or something similar) on all platforms in the future?

If I am not mistaken, this API is what the guys over at NewRelic are missing in order to instrument .NET apps on non-Windows hosts. For reference: https://docs.newrelic.com/docs/agents/net-agent/getting-started/new-relic-net#app-frameworks

— Reply to this email directly or view it on GitHub https://github.com/dotnet/coreclr/issues/445#issuecomment-108908467.

Studying for the Turing test

gregoryyoung avatar Jun 04 '15 14:06 gregoryyoung

This issue should not have been closed. Yes, we should enable the profiling APIs on Unix to support the ecosystem of tools build on top of them going cross-plat. We are aiming for as much parity as possible for the runtime capabilities across platforms.

cc @sergiy-k @mikem8361 @noahfalk

jkotas avatar Jun 04 '15 16:06 jkotas

I've begun to work on this a bit. You can track my progress (or tell me that I'm doing something terrible) at https://github.com/david-mitchell/coreclr/tree/enable-profiling

amanda-mitchell avatar Jul 15 '15 16:07 amanda-mitchell

:+1:

On Wed, Jul 15, 2015 at 5:56 PM, David Mitchell [email protected] wrote:

I've begun to work on this a bit. You can track my progress (or tell me that I'm doing something terrible) at https://github.com/david-mitchell/coreclr/tree/enable-profiling

— Reply to this email directly or view it on GitHub https://github.com/dotnet/coreclr/issues/445#issuecomment-121678593.

Studying for the Turing test

gregoryyoung avatar Jul 15 '15 17:07 gregoryyoung

:+1:

sawilde avatar Jul 15 '15 22:07 sawilde

Thanks @david-mitchell ! Last I heard a new coworker here at msft will looking at this area soon (he is still in process of transferring teams). In the meantime feel free to reach out to me for any questions, feedback, PRs, etc.

noahfalk avatar Jul 15 '15 23:07 noahfalk

I've got the Profiling API building on OS X (haven't tried Linux yet), and I've created a proof-of-concept profiler at https://github.com/david-mitchell/CoreCLRProfiler

amanda-mitchell avatar Jul 17 '15 23:07 amanda-mitchell

Just my .02 I actually prefer the mono model on this one. It is far easier to comprehend than transporting the windows model.

gregoryyoung avatar Jul 17 '15 23:07 gregoryyoung

@gregoryyoung the MS Profiling API has a number of features that are not present in mono's profiler. The New Relic profiler, for example, could not be built on top of Mono's Profiling API as it exists today. (see https://github.com/david-mitchell/NewRelicProfiler for more information on this)

amanda-mitchell avatar Jul 18 '15 00:07 amanda-mitchell

@david-mitchell - all I see is code, no details on the issues - perhaps you could expand more (even if you put it in the wiki).

As @gregoryyoung says the mono approach does seem much cleaner (once you get past the low documentation footprint) than the windows COM way; all that constant querying via COM interfaces (I know I've done my fair share of it) is awfully tedious.

I'd be interested to know where the gaps were when/if I decide to go ahead on the mono version of OpenCover.

sawilde avatar Jul 18 '15 00:07 sawilde

The main issue is that the MS version of the API supplies for method rewriting—along with provisions for allocating memory to be used for this purpose and other related functionality—which mono does not.

In any case, the COM API already exists in CoreCLR, and there are advantages to supporting it—for example, porting existing Windows profilers to OS X/Linux should be much easier if a similar API is preserved.

amanda-mitchell avatar Jul 18 '15 01:07 amanda-mitchell

Basically this boils down to rejit, which is a big thing for profiler vendors. No?

kangaroo avatar Jul 18 '15 05:07 kangaroo

Basically this boils down to rejit, which is a big thing for profiler vendors. No?

Nope, looked into it but in the end never really found a need for it - can't talk for the commercial guys but I've yet to see any code in the open-source community that used it outside just exploratory testing. If however is @david-mitchell says there is no way to rewrite a method (I just assumed the profilers in the Open Source space had never needed to and so no obvious code sample) then that is a bit of a downer.

sawilde avatar Jul 18 '15 06:07 sawilde

TypeMock does rejit, using the profiler API, IIRC.

*Hibernating Rhinos Ltd *

Oren Eini* l CEO l *Mobile: + 972-52-548-6969

Office: +972-4-622-7811 *l *Fax: +972-153-4-622-7811

On Sat, Jul 18, 2015 at 9:34 AM, Shaun Wilde [email protected] wrote:

Basically this boils down to rejit, which is a big thing for profiler vendors. No?

Nope, looked into it but in the end never really found a need for it - can't talk for the commercial guys but I've yet to see any code in the open-source community that used it outside just exploratory testing. If however is @david-mitchell https://github.com/david-mitchell says there is no way to rewrite a method (I just assumed the profilers in the Open Source space had never needed to and so no obvious code sample) then that is a bit of a downer.

— Reply to this email directly or view it on GitHub https://github.com/dotnet/coreclr/issues/445#issuecomment-122498114.

ayende avatar Jul 18 '15 07:07 ayende