Skip to content
This repository was archived by the owner on Nov 15, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bf51ad2
refactor around issue #457
sawilde Jan 13, 2016
e85394b
Merge pull request #473 from sawilde/master
sawilde Jan 13, 2016
c11bcb0
MemoryManager tests modified
Jan 13, 2016
7472ba5
Merge pull request #475 from ddur/master
ddur Jan 13, 2016
10f7429
Covers one more branch
Jan 13, 2016
de15bae
Merge pull request #476 from ddur/master
ddur Jan 14, 2016
c0236c6
wrap regsvr32 calls in try/catch + user message #457
sawilde Jan 14, 2016
908f5e8
wrap filter errors and throw a non-reporting exception #477
sawilde Jan 14, 2016
b289635
report on failing to start target process #478
sawilde Jan 14, 2016
af0d9d4
refactor exception to be a non-reporting exeception.
sawilde Jan 14, 2016
f38959f
Note & Remove spaces before matching
Jan 16, 2016
bb9cf92
Merge pull request #483 from ddur/master
ddur Jan 16, 2016
63b14b1
ensure element count in buffer is reset to 0 #482
sawilde Jan 17, 2016
76c0525
Refactor Contract matching
Jan 17, 2016
f7b4ce2
Merge pull request #484 from ddur/master
ddur Jan 17, 2016
8188315
Merge pull request #485 from sawilde/master
sawilde Jan 17, 2016
feb828b
Refactor and comment
Jan 17, 2016
378ed58
Merge pull request #486 from ddur/master
ddur Jan 17, 2016
ffc010d
Make process-filter consistent in all filters
Jan 17, 2016
2340b0e
Merge pull request #487 from ddur/master
ddur Jan 17, 2016
28433ec
Fix regex, find offset on user methods only
Jan 17, 2016
283e67f
Merge pull request #488 from ddur/master
ddur Jan 17, 2016
a5cb9d7
Feature+ Matching assembly by path
Jan 17, 2016
2458590
Merge pull request #489 from ddur/master
ddur Jan 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ensure element count in buffer is reset to 0 #482
  • Loading branch information
sawilde committed Jan 17, 2016
commit 63b14b1cd97bdd4e042d3642a9f49fe38b7c70e7
35 changes: 23 additions & 12 deletions main/OpenCover.Profiler/ProfilerCommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ProfilerCommunication::ProfilerCommunication(DWORD short_wait)
_hostCommunicationActive = false;
_short_wait = short_wait;
ATLASSERT(MAX_MSG_SIZE >= sizeof(MSG_Union));
ATLASSERT(MAX_MSG_SIZE >= sizeof(MSG_SendVisitPoints_Request));
ATLTRACE(_T("Buffer %d, Union %ld, Visit %ld"), MAX_MSG_SIZE, sizeof(MSG_Union), sizeof(MSG_SendVisitPoints_Request));
}

ProfilerCommunication::~ProfilerCommunication()
Expand Down Expand Up @@ -252,20 +254,25 @@ void ProfilerCommunication::AddVisitPointToThreadBuffer(ULONG uniqueId, MSG_IdTy
void ProfilerCommunication::SendThreadVisitPoints(MSG_SendVisitPoints_Request* pVisitPoints){
ATL::CComCritSecLock<ATL::CComAutoCriticalSection> lock(_critResults);

SendThreadVisitPointsInternal(pVisitPoints);

pVisitPoints->count = 0;
}

void ProfilerCommunication::SendThreadVisitPointsInternal(MSG_SendVisitPoints_Request* pVisitPoints) {
ATL::CComCritSecLock<ATL::CComAutoCriticalSection> lock(_critResults);

if (!_hostCommunicationActive)
return;

if (!TestSemaphore(_semapore_results))
return;

handle_exception([=](){
handle_exception([=]() {
memcpy(_pVisitPoints, pVisitPoints, sizeof(MSG_SendVisitPoints_Request));
}, _T("SendThreadVisitPoints"));

pVisitPoints->count = 0;
SendVisitPoints();
//::ZeroMemory(_pVisitPoints, sizeof(MSG_SendVisitPoints_Request));
_pVisitPoints->count = 0;
}

void ProfilerCommunication::AddVisitPointToBuffer(ULONG uniqueId, MSG_IdType msgType)
Expand All @@ -285,26 +292,30 @@ void ProfilerCommunication::AddVisitPointToBuffer(ULONG uniqueId, MSG_IdType msg
if (++_pVisitPoints->count == VP_BUFFER_SIZE)
{
SendVisitPoints();
//::ZeroMemory(_pVisitPoints, sizeof(MSG_SendVisitPoints_Request));
handle_exception([=](){
_pVisitPoints->count = 0;
}, _T("AddVisitPointToBuffer"));
}
}

void ProfilerCommunication::SendVisitPoints()
{
if (!_hostCommunicationActive)
SendVisitPointsInternal();
handle_exception([=]() {
_pVisitPoints->count = 0;
}, _T("SendVisitPoints"));
}

void ProfilerCommunication::SendVisitPointsInternal() {
if (!_hostCommunicationActive)
return;
try {
_memoryResults.FlushViewOfFile();

DWORD dwSignal = _eventProfilerHasResults.SignalAndWait(_eventResultsHaveBeenReceived, _short_wait);
if (WAIT_OBJECT_0 != dwSignal) throw CommunicationException(dwSignal, _short_wait);
_eventResultsHaveBeenReceived.Reset();
} catch (CommunicationException ex) {
RELTRACE(_T("ProfilerCommunication::SendVisitPoints() => Communication (Results channel) with host has failed (0x%x, %d)"),
ex.getReason(), ex.getTimeout());
}
catch (CommunicationException ex) {
RELTRACE(_T("ProfilerCommunication::SendVisitPoints() => Communication (Results channel) with host has failed (0x%x, %d)"),
ex.getReason(), ex.getTimeout());
_hostCommunicationActive = false;
}
return;
Expand Down
2 changes: 2 additions & 0 deletions main/OpenCover.Profiler/ProfilerCommunication.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class ProfilerCommunication
private:
void AddVisitPointToBuffer(ULONG uniqueId, MSG_IdType msgType);
void SendVisitPoints();
void SendVisitPointsInternal();
void SendThreadVisitPoints(MSG_SendVisitPoints_Request* pVisitPoints);
void SendThreadVisitPointsInternal(MSG_SendVisitPoints_Request* pVisitPoints);
bool GetSequencePoints(mdToken functionToken, WCHAR* pModulePath, WCHAR* pAssemblyName, std::vector<SequencePoint> &points);
bool GetBranchPoints(mdToken functionToken, WCHAR* pModulePath, WCHAR* pAssemblyName, std::vector<BranchPoint> &points);
void SendRemainingThreadBuffers();
Expand Down