summaryrefslogtreecommitdiff
path: root/src/vm/perfmap.h
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2015-11-09 17:50:56 -0800
committerBrian Robbins <brianrob@microsoft.com>2015-11-12 13:04:47 -0800
commit3801b5493e9d4b8837ceec03f49707656877fff1 (patch)
tree23828a8ede5c24422479fc062aa2800b2ffa4418 /src/vm/perfmap.h
parent128546aed70f8f24efebd50b0f6c358f41ff9756 (diff)
downloadcoreclr-3801b5493e9d4b8837ceec03f49707656877fff1.tar.gz
coreclr-3801b5493e9d4b8837ceec03f49707656877fff1.tar.bz2
coreclr-3801b5493e9d4b8837ceec03f49707656877fff1.zip
Enable offline generation of text-based symbol tables for native images. This is needed in order to profile applications on Linux using perf_event.
This change also modifies the runtime to emit a perfmap entry when a native image is loaded so that offline trace processing tools can identify when a perfmap file for a native image is needed and generate it.
Diffstat (limited to 'src/vm/perfmap.h')
-rw-r--r--src/vm/perfmap.h49
1 files changed, 41 insertions, 8 deletions
diff --git a/src/vm/perfmap.h b/src/vm/perfmap.h
index e0539150fc..f35084d4c4 100644
--- a/src/vm/perfmap.h
+++ b/src/vm/perfmap.h
@@ -11,6 +11,7 @@
#include "sstring.h"
#include "fstream.h"
+// Generates a perfmap file.
class PerfMap
{
private:
@@ -23,27 +24,59 @@ private:
// Set to true if an error is encountered when writing to the file.
bool m_ErrorEncountered;
- // Construct a new map.
+ // Construct a new map for the specified pid.
PerfMap(int pid);
+ // Write a line to the map file.
+ void WriteLine(SString & line);
+
+protected:
+ // Construct a new map without a specified file name.
+ // Used for offline creation of NGEN map files.
+ PerfMap();
+
// Clean-up resources.
~PerfMap();
- // Does the actual work to log to the map.
- void Log(MethodDesc * pMethod, PCODE pCode, size_t codeSize);
+ // Open the perf map file for write.
+ void OpenFile(SString& path);
+
+ // Does the actual work to log a method to the map.
+ void LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize);
+
+ // Does the actual work to log a native image load to the map.
+ void LogNativeImage(PEFile * pFile);
- // Does the actual work to close and flush the map.
- void Close();
+ // Get the native image signature and store it as a string.
+ static void GetNativeImageSignature(PEFile * pFile, WCHAR * pwszSig, unsigned int nSigSize);
public:
// Initialize the map for the current process.
static void Initialize();
- // Log a method to the map.
- static void LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize);
-
+ // Log a native image load to the map.
+ static void LogNativeImageLoad(PEFile * pFile);
+
+ // Log a JIT compiled method to the map.
+ static void LogJITCompiledMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize);
+
// Close the map and flush any remaining data.
static void Destroy();
};
+// Generates a perfmap file for a native image by running crossgen.
+class NativeImagePerfMap : PerfMap
+{
+private:
+ // Log a pre-compiled method to the map.
+ void LogPreCompiledMethod(MethodDesc * pMethod, PCODE pCode, SIZE_T baseAddr);
+
+public:
+ // Construct a new map for a native image.
+ NativeImagePerfMap(Assembly * pAssembly, BSTR pDestPath);
+
+ // Log method information for each module.
+ void LogDataForModule(Module * pModule);
+};
+
#endif // PERFPID_H