-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathapi.cpp
More file actions
47 lines (37 loc) · 1.43 KB
/
api.cpp
File metadata and controls
47 lines (37 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "api.h"
#include "instrumenter.h"
#include "logging.h"
#include "cComPtr.h"
#include "os.h"
#include "profilerState.h"
#include <vector>
using namespace vsharp;
extern "C" void SetEntryMain(char* assemblyName, int assemblyNameLength, char* moduleName, int moduleNameLength, int methodToken) {
profilerState->setEntryMain(assemblyName, assemblyNameLength, moduleName, moduleNameLength, methodToken);
LOG(tout << "received entry main" << std::endl);
}
extern "C" void GetHistory(UINT_PTR size, UINT_PTR bytes) {
LOG(tout << "GetHistory request received! serializing and writing the response");
std::atomic_fetch_add(&shutdownBlockingRequestsCount, 1);
size_t tmpSize;
historyBuffer = profilerState->coverageTracker->serializeCoverageReport(&tmpSize);
*(ULONG*)size = tmpSize;
*(char**)bytes = historyBuffer;
profilerState->coverageTracker->clear();
profilerState->threadTracker->clear();
std::atomic_fetch_sub(&shutdownBlockingRequestsCount, 1);
LOG(tout << "GetHistory request handled!");
}
extern "C" void ClearHistory() {
delete historyBuffer;
historyBuffer = nullptr;
}
extern "C" void SetCurrentThreadId(int mapId) {
LOG(tout << "Map current thread to: " << mapId);
vsharp::profilerState->threadTracker->mapCurrentThread(mapId);
}
extern "C" void SetStackBottom() {
LOG(tout << "Bottom marker was set");
// TODO: Implement tracking stack size
int stackBottomMarker;
}