-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a README.md for Profiling Samples
- Loading branch information
Showing
18 changed files
with
2,121 additions
and
2,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# EditorConfig is awesome: | ||
http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Default settings: | ||
# A newline ending every file | ||
# Use 4 spaces as indentation | ||
# Trim trailing whitespace | ||
[*] | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{asm,inc}] | ||
indent_size = 8 | ||
|
||
# Xml project files | ||
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] | ||
indent_size = 2 | ||
|
||
# Xml config files | ||
[*.{props,targets,config,nuspec}] | ||
indent_size = 2 | ||
|
||
[CMakeLists.txt] | ||
indent_size = 2 | ||
|
||
[*.cmd] | ||
indent_size = 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain | ||
|
||
*.in text eol=lf | ||
*.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,3 +234,4 @@ _Pvt_Extensions | |
|
||
# FAKE - F# Make | ||
.fake/ | ||
*.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Profiling API Samples for CoreCLR | ||
|
||
This directory houses samples using the CoreCLR Profiler APIs. | ||
|
||
The sample code in this repository is being provided to the community `AS-IS`. It is the profiler authors responsibility to verify that the sample code provided is built, tested and behaves correctly for their platform and particular scenario. Although the samples were verified initially when they were written, there is no continous testing enabled for them. | ||
|
||
Additionally the samples may use profiling APIs that are currently considered unsupported/untested. | ||
|
||
Please check the [Profiling API Status](https://github.com/dotnet/coreclr/tree/master/Documentation/project-docs/profiling-api-status.md) when building your profiler that may target multiple platforms to verify which APIs have been ported and tested for your target platform. | ||
|
||
## Native SDK for consuming the Profiler APIs | ||
|
||
Profilers using the CoreCLR Profiling APIs are unmanaged components that require the native headers and static libraries to compile against. | ||
|
||
Samples in this repository refer to instructions in the CoreCLR repo to build it, and then compile against the built output of that CoreCLR. | ||
|
||
While this gets the profiler author up-and-running, using headers and libraries from a local CoreCLR build is a temporary setup until the .NET team is able to provide a more reasonable cross-platform SDK. | ||
|
||
## Samples | ||
|
||
* [ReJIT Enter Leave Hooks Profiler](https://github.com/Microsoft/clr-samples/tree/master/ProfilingAPI/ReJITEnterLeaveHooks) - This sample demonstrates a cross-platform portable profiler that rewrites the incoming method `CIL` to add a hook to a profiler supplied function that is called at method entry and exit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,81 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
#pragma once | ||
|
||
template<class TInterface> | ||
class CComPtr | ||
{ | ||
private: | ||
TInterface* pointer; | ||
public: | ||
CComPtr(const CComPtr&) = delete; // Copy constructor | ||
CComPtr& operator= (const CComPtr&) = delete; // Copy assignment | ||
CComPtr(CComPtr&&) = delete; // Move constructor | ||
CComPtr& operator= (CComPtr&&) = delete; // Move assignment | ||
|
||
void* operator new(std::size_t) = delete; | ||
void* operator new[](std::size_t) = delete; | ||
|
||
void operator delete(void *ptr) = delete; | ||
void operator delete[](void *ptr) = delete; | ||
|
||
CComPtr() | ||
{ | ||
this->pointer = nullptr; | ||
} | ||
|
||
~CComPtr() | ||
{ | ||
if (this->pointer) | ||
{ | ||
this->pointer->Release(); | ||
this->pointer = nullptr; | ||
} | ||
} | ||
|
||
operator TInterface*() | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
operator TInterface*() const | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
TInterface& operator *() | ||
{ | ||
return *this->pointer; | ||
} | ||
|
||
TInterface& operator *() const | ||
{ | ||
return *this->pointer; | ||
} | ||
|
||
TInterface** operator&() | ||
{ | ||
return &this->pointer; | ||
} | ||
|
||
TInterface** operator&() const | ||
{ | ||
return &this->pointer; | ||
} | ||
|
||
TInterface* operator->() | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
TInterface* operator->() const | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
void Release() | ||
{ | ||
this->~CComPtr(); | ||
} | ||
}; | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
#pragma once | ||
|
||
template<class TInterface> | ||
class CComPtr | ||
{ | ||
private: | ||
TInterface* pointer; | ||
public: | ||
CComPtr(const CComPtr&) = delete; // Copy constructor | ||
CComPtr& operator= (const CComPtr&) = delete; // Copy assignment | ||
CComPtr(CComPtr&&) = delete; // Move constructor | ||
CComPtr& operator= (CComPtr&&) = delete; // Move assignment | ||
|
||
void* operator new(std::size_t) = delete; | ||
void* operator new[](std::size_t) = delete; | ||
|
||
void operator delete(void *ptr) = delete; | ||
void operator delete[](void *ptr) = delete; | ||
|
||
CComPtr() | ||
{ | ||
this->pointer = nullptr; | ||
} | ||
|
||
~CComPtr() | ||
{ | ||
if (this->pointer) | ||
{ | ||
this->pointer->Release(); | ||
this->pointer = nullptr; | ||
} | ||
} | ||
|
||
operator TInterface*() | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
operator TInterface*() const | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
TInterface& operator *() | ||
{ | ||
return *this->pointer; | ||
} | ||
|
||
TInterface& operator *() const | ||
{ | ||
return *this->pointer; | ||
} | ||
|
||
TInterface** operator&() | ||
{ | ||
return &this->pointer; | ||
} | ||
|
||
TInterface** operator&() const | ||
{ | ||
return &this->pointer; | ||
} | ||
|
||
TInterface* operator->() | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
TInterface* operator->() const | ||
{ | ||
return this->pointer; | ||
} | ||
|
||
void Release() | ||
{ | ||
this->~CComPtr(); | ||
} | ||
}; |
Oops, something went wrong.