You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
This patch revives PP poorman's profiling using StopWatch class
This commit is contained in:
@@ -2155,11 +2155,15 @@ void BatchPrimitiveProcessor::makeResponse()
|
|||||||
int BatchPrimitiveProcessor::operator()()
|
int BatchPrimitiveProcessor::operator()()
|
||||||
{
|
{
|
||||||
utils::setThreadName("PPBatchPrimProc");
|
utils::setThreadName("PPBatchPrimProc");
|
||||||
|
#ifdef PRIMPROC_STOPWATCH
|
||||||
|
const static std::string msg{"BatchPrimitiveProcessor::operator()"};
|
||||||
|
logging::StopWatch* stopwatch = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (currentBlockOffset == 0)
|
if (currentBlockOffset == 0)
|
||||||
{
|
{
|
||||||
#ifdef PRIMPROC_STOPWATCH // TODO: needs to be brought up-to-date
|
#ifdef PRIMPROC_STOPWATCH
|
||||||
map<pthread_t, logging::StopWatch*>::iterator stopwatchMapIter = stopwatchMap.find(pthread_self());
|
auto stopwatchMapIter = stopwatchMap.find(pthread_self());
|
||||||
logging::StopWatch* stopwatch;
|
|
||||||
|
|
||||||
if (stopwatchMapIter != stopwatchMap.end())
|
if (stopwatchMapIter != stopwatchMap.end())
|
||||||
{
|
{
|
||||||
@@ -2169,7 +2173,7 @@ int BatchPrimitiveProcessor::operator()()
|
|||||||
{
|
{
|
||||||
pthread_mutex_lock(&stopwatchMapMutex);
|
pthread_mutex_lock(&stopwatchMapMutex);
|
||||||
stopwatch = new logging::StopWatch(stopwatchMap.size());
|
stopwatch = new logging::StopWatch(stopwatchMap.size());
|
||||||
stopwatchMap.insert(make_pair(pthread_self(), stopwatch));
|
stopwatchMap.insert({pthread_self(), stopwatch});
|
||||||
|
|
||||||
// Create the thread that will show timing results after five seconds of idle time.
|
// Create the thread that will show timing results after five seconds of idle time.
|
||||||
if (!stopwatchThreadCreated)
|
if (!stopwatchThreadCreated)
|
||||||
@@ -2186,9 +2190,6 @@ int BatchPrimitiveProcessor::operator()()
|
|||||||
pthread_mutex_unlock(&stopwatchMapMutex);
|
pthread_mutex_unlock(&stopwatchMapMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
ostringstream oss;
|
|
||||||
oss << "BatchPrimitiveProcessor::operator()";
|
|
||||||
string msg = oss.str();
|
|
||||||
stopwatch->start(msg);
|
stopwatch->start(msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -2628,7 +2628,7 @@ bool BPPV::aborted()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PRIMPROC_STOPWATCH
|
#ifdef PRIMPROC_STOPWATCH
|
||||||
map<pthread_t, logging::StopWatch*> stopwatchMap;
|
std::unordered_map<pthread_t, logging::StopWatch*> stopwatchMap;
|
||||||
pthread_mutex_t stopwatchMapMutex;
|
pthread_mutex_t stopwatchMapMutex;
|
||||||
bool stopwatchThreadCreated = false;
|
bool stopwatchThreadCreated = false;
|
||||||
|
|
||||||
@@ -2670,7 +2670,7 @@ void* autoFinishStopwatchThread(void* arg)
|
|||||||
pause_(2);
|
pause_(2);
|
||||||
count++;
|
count++;
|
||||||
// Iterate through the stopwatch map and see how long it's been since last activity.
|
// Iterate through the stopwatch map and see how long it's been since last activity.
|
||||||
map<pthread_t, logging::StopWatch*>::iterator stopwatchMapIter = stopwatchMap.begin();
|
auto stopwatchMapIter = stopwatchMap.begin();
|
||||||
logging::StopWatch* stopwatch;
|
logging::StopWatch* stopwatch;
|
||||||
gettimeofday(&tvCurrent, 0);
|
gettimeofday(&tvCurrent, 0);
|
||||||
bool primProcIdle = true;
|
bool primProcIdle = true;
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <tr1/unordered_map>
|
#include <tr1/unordered_map>
|
||||||
#include <tr1/unordered_set>
|
#include <tr1/unordered_set>
|
||||||
|
#include <unordered_map>
|
||||||
#endif
|
#endif
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ extern boost::mutex bppLock;
|
|||||||
extern uint32_t highPriorityThreads, medPriorityThreads, lowPriorityThreads;
|
extern uint32_t highPriorityThreads, medPriorityThreads, lowPriorityThreads;
|
||||||
|
|
||||||
#ifdef PRIMPROC_STOPWATCH
|
#ifdef PRIMPROC_STOPWATCH
|
||||||
extern std::map<pthread_t, logging::StopWatch*> stopwatchMap;
|
extern std::unordered_map<pthread_t, logging::StopWatch*> stopwatchMap;
|
||||||
extern pthread_mutex_t stopwatchMapMutex;
|
extern pthread_mutex_t stopwatchMapMutex;
|
||||||
extern bool stopwatchThreadCreated;
|
extern bool stopwatchThreadCreated;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user