Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cf2c2cf
test process generalization
planetchili Oct 28, 2025
4fe4c1f
pull TestProcess into own header
planetchili Oct 28, 2025
8690308
improving test process util
planetchili Oct 28, 2025
9c20249
test proc util in etl logger tests
planetchili Oct 28, 2025
43f9ea9
fixture in dynamic polled
planetchili Oct 29, 2025
d959991
paced polling refactor working
planetchili Oct 31, 2025
0c9575a
small fixes
planetchili Nov 3, 2025
4d8fcfc
digit buffer for sorting
planetchili Nov 3, 2025
8318a8f
add script for paced analysis
planetchili Nov 3, 2025
e395da2
move paced polling client module into sample client app
planetchili Nov 4, 2025
71fe81a
better config options for paced sample client test driver
planetchili Nov 4, 2025
b61eaf6
factor out test run routine from test case class/method
planetchili Nov 4, 2025
21bfc16
establish aux test data folder
planetchili Nov 4, 2025
983ed85
better test case replication
planetchili Nov 4, 2025
ce21e18
update gold for minimized etl
planetchili Nov 5, 2025
3349526
fixing round robin client params and tweaking fuzzy params
planetchili Nov 5, 2025
958dc8a
1st draft of aux push
planetchili Nov 6, 2025
c3e5ebc
lockfile bootstrap
planetchili Nov 6, 2025
28f6519
subdir, no public commit, no csv diff
planetchili Nov 6, 2025
4f017aa
ignore auxdata subdir
planetchili Nov 6, 2025
6d8ab15
stop tracking aux gitignore
planetchili Nov 6, 2025
57970bd
remove old paced gold
planetchili Nov 6, 2025
a5dd1a2
change to target master
planetchili Nov 6, 2025
e4a1e63
push script incremental improvements
planetchili Nov 6, 2025
1fe771d
script approaching v1
planetchili Nov 6, 2025
f262754
update aux lock
planetchili Nov 6, 2025
7d2b05a
update tests for new auxdata location
planetchili Nov 6, 2025
9354dd7
aux pull working
planetchili Nov 6, 2025
dba091b
py script upgrade
planetchili Nov 10, 2025
07af16f
more info in test window
planetchili Nov 10, 2025
e277626
tracking metadata event count in trimmer and update auxdata lock
planetchili Nov 17, 2025
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
9 changes: 9 additions & 0 deletions ETLTrimmer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class EventCallback : public ITraceEventCallback
// analysis stats
int eventCount_ = 0;
int keepCount_ = 0;
int metadataEventCount_ = 0;
std::optional<uint64_t> firstTimestamp_;
uint64_t lastTimestamp_ = 0;
std::unordered_map<uint32_t, uint64_t> eventCountByProcess_;
Expand Down Expand Up @@ -218,6 +219,9 @@ class EventCallback : public ITraceEventCallback
}
lastTimestamp_ = ts;
eventCount_++;
if (hdr.ProviderId == Microsoft_Windows_EventMetadata::GUID) {
metadataEventCount_++;
}
bool canDiscard = true;
if (trimRangeQpc_) {
// tail events always discardable
Expand Down Expand Up @@ -278,6 +282,10 @@ class EventCallback : public ITraceEventCallback
{
trimRangeMs_ = range;
}
int GetMetadataEventCount() const
{
return metadataEventCount_;
}
int GetKeepCount() const
{
return keepCount_;
Expand Down Expand Up @@ -416,6 +424,7 @@ int main(int argc, const char** argv)
const auto dur = tsr.second - tsr.first;
std::cout << std::format(" ======== Report for [ {} ] ========\n", *opt.inputFile);
std::cout << std::format("Total event count: {:L}\n", pCallbackProcessor->GetEventCount());
std::cout << std::format("Metadata event count: {:L}\n", pCallbackProcessor->GetMetadataEventCount());
std::cout << std::format("Timestamp range {:L} - {:L} (duration: {:L})\n", tsr.first, tsr.second, dur);
std::cout << std::format("Duration of trace in milliseconds: {:L}\n\n", double(dur) / 10'000.);

Expand Down
2 changes: 1 addition & 1 deletion IntelPresentMon/AppCef/source/util/LogSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ namespace p2c::client::util
try {
const auto fullPipeName = R"(\\.\pipe\)" + pipePrefix;
// wait maximum 1.5sec for pipe to be created
if (!pipe::DuplexPipe::WaitForAvailability(fullPipeName, 1500)) {
if (!pipe::DuplexPipe::WaitForAvailability(fullPipeName, 1500, true)) {
pmlog_warn(std::format("Failed to connect to logging source server {} after waiting 1.5s", pipePrefix));
return;
}
Expand Down
19 changes: 18 additions & 1 deletion IntelPresentMon/CommonUtilities/pipe/Pipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ namespace pmon::util::pipe
{
return writeBuf_.consume(GetWriteBufferPending());
}
bool DuplexPipe::WaitForAvailability(const std::string& name, uint32_t timeoutMs, uint32_t pollPeriodMs)
bool DuplexPipe::WaitForAvailability(const std::string& baseName, uint32_t timeoutMs, bool noSuffix, uint32_t pollPeriodMs)
{
const auto name = baseName + (noSuffix ? "" : "-in");
const auto start = std::chrono::high_resolution_clock::now();
while (std::chrono::high_resolution_clock::now() - start < 1ms * timeoutMs) {
if (WaitNamedPipeA(name.c_str(), 0)) {
Expand All @@ -86,6 +87,22 @@ namespace pmon::util::pipe
}
return false;
}
bool DuplexPipe::WaitForVacancy(const std::string& baseName, uint32_t timeoutMs, bool noSuffix, uint32_t pollPeriodMs)
{
const auto name = baseName + (noSuffix ? "" : "-out");
const auto start = std::chrono::high_resolution_clock::now();
while (std::chrono::high_resolution_clock::now() - start < 1ms * timeoutMs) {
if (!WaitNamedPipeA(name.c_str(), 0)) {
const DWORD err = GetLastError();
if (err == ERROR_FILE_NOT_FOUND) {
return true; // Vacant: no pipe instances exist.
}
}
std::this_thread::sleep_for(1ms * pollPeriodMs);
}
return false;
}

uint32_t DuplexPipe::GetId() const
{
return uid_;
Expand Down
3 changes: 2 additions & 1 deletion IntelPresentMon/CommonUtilities/pipe/Pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ namespace pmon::util::pipe
}
size_t GetWriteBufferPending() const;
void ClearWriteBuffer();
static bool WaitForAvailability(const std::string& name, uint32_t timeoutMs, uint32_t pollPeriodMs = 10);
static bool WaitForAvailability(const std::string& baseName, uint32_t timeoutMs, bool noSuffix = false, uint32_t pollPeriodMs = 5);
static bool WaitForVacancy(const std::string& baseName, uint32_t timeoutMs, bool noSuffix = false, uint32_t pollPeriodMs = 5);
uint32_t GetId() const;
std::string GetName() const;
static std::string GetSecurityString(SecurityMode mode);
Expand Down
2 changes: 1 addition & 1 deletion IntelPresentMon/Core/source/infra/LogSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ namespace p2c
try {
const auto fullPipeName = R"(\\.\pipe\)" + pipePrefix;
// wait maximum 1.5sec for pipe to be created
if (!pipe::DuplexPipe::WaitForAvailability(fullPipeName, 1500)) {
if (!pipe::DuplexPipe::WaitForAvailability(fullPipeName, 1500, true)) {
pmlog_warn(std::format("Failed to connect to logging source server {} after waiting 1.5s", pipePrefix));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion IntelPresentMon/Core/source/kernel/InjectorComplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace p2c::kern
try {
int pid = std::stoi(line);
const auto pipeName = inj::act::MakePipeName(pid);
::pmon::util::pipe::DuplexPipe::WaitForAvailability(pipeName + "-in", 2'000, 250);
::pmon::util::pipe::DuplexPipe::WaitForAvailability(pipeName, 2'000, false, 250);
{
std::lock_guard lk{ actionClientMutex_ };
injectionPointClient_.emplace(pipeName);
Expand Down
15 changes: 11 additions & 4 deletions IntelPresentMon/PresentMonAPI2/PresentMonAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ PRESENTMON_API2_EXPORT PM_STATUS pmGetIntrospectionRoot(PM_SESSION_HANDLE handle
return PM_STATUS_BAD_ARGUMENT;
}
const auto pIntro = LookupMiddleware_(handle).GetIntrospectionData();
AddHandleMapping_(handle, pIntro);
// we don't need the middleware to free introspection data
// detaching like this (eliding handle mapping) will allow introspection data
// to not obstruct cleanup of middleware
// if the lifecycle of marshalled introspection data changes this might need to
// change as well
// AddHandleMapping_(handle, pIntro);
*ppInterface = pIntro;
return PM_STATUS_SUCCESS;
}
Expand All @@ -212,9 +217,11 @@ PRESENTMON_API2_EXPORT PM_STATUS pmFreeIntrospectionRoot(const PM_INTROSPECTION_
// freeing nullptr is a no-op
return PM_STATUS_SUCCESS;
}
auto& mid = LookupMiddleware_(pInterface);
RemoveHandleMapping_(pInterface);
mid.FreeIntrospectionData(pInterface);
// see note in pmGetIntrospectionRoot above
// RemoveHandleMapping_(pInterface);
// if we free directly here instead of using the middleware method
// we can support freeing even after middleware has been destroyed
free(const_cast<PM_INTROSPECTION_ROOT*>(pInterface));
return PM_STATUS_SUCCESS;
}
catch (...) {
Expand Down
Loading