Compare commits

...

2 Commits

Author SHA1 Message Date
hayodea e94aaf9323 Update include paths and namespacing 2026-05-17 17:26:21 -04:00
hayodea 83ad680c68 Move cps files into cps/ 2026-05-17 17:25:29 -04:00
20 changed files with 99 additions and 99 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
#include <config.h>
#include <atomic>
#include <memory>
#include <spinscale/callback.h>
#include <spinscale/cps/callback.h>
#include <spinscale/puppetApplication.h>
namespace sscl {
+6 -6
View File
@@ -13,7 +13,7 @@
#include <sched.h>
#include <unistd.h>
#include <memory>
#include <spinscale/callback.h>
#include <spinscale/cps/callback.h>
#include <cstdint>
#include <string>
@@ -162,10 +162,10 @@ public:
// Thread management methods
typedef std::function<void()> threadLifetimeMgmtOpCbFn;
void startThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
void exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
void pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
void resumeThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
void startThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
void exitThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
void pauseThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
void resumeThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
/**
* JOLTs this thread to begin processing after global initialization.
@@ -180,7 +180,7 @@ public:
*/
void joltThreadReq(
const std::shared_ptr<PuppetThread>& selfPtr,
Callback<threadLifetimeMgmtOpCbFn> callback);
cps::Callback<threadLifetimeMgmtOpCbFn> callback);
// CPU management methods
void pinToCpu(int cpuId);
@@ -5,7 +5,7 @@
#include <atomic>
#include <boost/asio/io_service.hpp>
namespace sscl {
namespace sscl::cps {
class AsynchronousBridge
{
@@ -53,6 +53,6 @@ private:
boost::asio::io_service &io_service;
};
} // namespace sscl
} // namespace sscl::cps
#endif // ASYNCHRONOUS_BRIDGE_H
@@ -5,12 +5,12 @@
#include <memory>
#include <exception>
#include <spinscale/componentThread.h>
#include <spinscale/callback.h>
#include <spinscale/callableTracer.h>
#include <spinscale/asynchronousContinuationChainLink.h>
#include <spinscale/cps/callback.h>
#include <spinscale/cps/callableTracer.h>
#include <spinscale/cps/asynchronousContinuationChainLink.h>
namespace sscl {
namespace sscl::cps {
/**
* AsynchronousContinuation - Template base class for async sequence management
@@ -129,7 +129,7 @@ class PostedAsynchronousContinuation
{
public:
PostedAsynchronousContinuation(
const std::shared_ptr<ComponentThread> &caller,
const std::shared_ptr<sscl::ComponentThread> &caller,
Callback<OriginalCbFnT> originalCbFn)
: AsynchronousContinuation<OriginalCbFnT>(originalCbFn),
caller(caller)
@@ -150,9 +150,9 @@ public:
}
public:
std::shared_ptr<ComponentThread> caller;
std::shared_ptr<sscl::ComponentThread> caller;
};
} // namespace sscl
} // namespace sscl::cps
#endif // ASYNCHRONOUS_CONTINUATION_H
@@ -4,10 +4,10 @@
#include <functional>
#include <memory>
#include <optional>
#include <vector>
#include <spinscale/lockSet.h>
namespace sscl {
namespace sscl::cps {
class LockSet;
/**
* @brief Base class for all asynchronous continuation chain links
@@ -38,6 +38,6 @@ public:
{ return std::nullopt; }
};
} // namespace sscl
} // namespace sscl::cps
#endif // ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H
@@ -8,7 +8,7 @@
#include <cstdint>
#include <spinscale/componentThread.h>
namespace sscl {
namespace sscl::cps {
/**
* @brief CallableTracer - Wraps callables with metadata for debugging
@@ -49,8 +49,8 @@ public:
if (optTraceCallables)
{
std::cout << "" << __func__ << ": On thread "
<< (ComponentThread::tlsInitialized()
? ComponentThread::getSelf()->name : "<TLS un-init'ed>")
<< (sscl::ComponentThread::tlsInitialized()
? sscl::ComponentThread::getSelf()->name : "<TLS un-init'ed>")
<< ": Calling callable posted by:\n"
<< "\t" << callerFuncName << "\n\tat line " << (int)callerLine
<< " return addr 0: " << returnAddr0
@@ -79,7 +79,7 @@ private:
std::function<void()> callable;
};
} // namespace sscl
} // namespace sscl::cps
/**
* @brief STC - SMO Traceable Callable macro
@@ -109,7 +109,7 @@ private:
// e.g., "void smo::SomeClass::method(int, int)"
// __builtin_return_address(0) = direct caller
// __builtin_return_address(1) = caller before that
#define STC(arg) sscl::CallableTracer( \
#define STC(arg) sscl::cps::CallableTracer( \
__PRETTY_FUNCTION__, \
__LINE__, \
__builtin_return_address(0), \
@@ -120,7 +120,7 @@ private:
// e.g., "void __cdecl smo::SomeClass::method(int, int)"
// _ReturnAddress() = direct caller (only one level available)
#include <intrin.h>
#define STC(arg) sscl::CallableTracer( \
#define STC(arg) sscl::cps::CallableTracer( \
__FUNCSIG__, \
__LINE__, \
_ReturnAddress(), \
@@ -129,7 +129,7 @@ private:
#else
// Fallback to standard __func__ (unqualified name only)
// No return address support
#define STC(arg) sscl::CallableTracer( \
#define STC(arg) sscl::cps::CallableTracer( \
__func__, \
__LINE__, \
nullptr, \
@@ -3,7 +3,7 @@
#include <memory>
namespace sscl {
namespace sscl::cps {
// Forward declaration
class AsynchronousContinuationChainLink;
@@ -26,6 +26,6 @@ public:
CbFnT callbackFn;
};
} // namespace sscl
} // namespace sscl::cps
#endif // SPINSCALE_CALLBACK_H
@@ -6,7 +6,7 @@
#include <vector>
#include <memory>
namespace sscl {
namespace sscl::cps {
// Forward declarations
class AsynchronousContinuationChainLink;
@@ -80,6 +80,6 @@ private:
AdjacencyList adjacencyList;
};
} // namespace sscl
} // namespace sscl::cps
#endif // DEPENDENCY_GRAPH_H
@@ -6,10 +6,10 @@
#include <utility>
#include <memory>
#include <optional>
#include <spinscale/qutex.h>
#include <spinscale/lockerAndInvokerBase.h>
#include <spinscale/cps/qutex.h>
#include <spinscale/cps/lockerAndInvokerBase.h>
namespace sscl {
namespace sscl::cps {
class Qutex;
@@ -280,6 +280,6 @@ private:
bool allLocksAcquired, registeredInQutexQueues;
};
} // namespace sscl
} // namespace sscl::cps
#endif // LOCK_SET_H
@@ -4,7 +4,7 @@
#include <list>
#include <memory>
namespace sscl {
namespace sscl::cps {
// Forward declaration
class Qutex;
@@ -82,6 +82,6 @@ protected:
const void* serializedContinuationVaddr;
};
} // namespace sscl
} // namespace sscl::cps
#endif // LOCKER_AND_INVOKER_BASE_H
@@ -6,9 +6,9 @@
#include <memory>
#include <string>
#include <spinscale/spinLock.h>
#include <spinscale/lockerAndInvokerBase.h>
#include <spinscale/cps/lockerAndInvokerBase.h>
namespace sscl {
namespace sscl::cps {
/**
* @brief Qutex - Queue-based mutex for asynchronous lock management
@@ -97,11 +97,11 @@ public:
std::string name;
std::shared_ptr<LockerAndInvokerBase> currOwner;
#endif
SpinLock lock;
sscl::SpinLock lock;
LockerAndInvokerBase::List queue;
bool isOwned;
};
} // namespace sscl
} // namespace sscl::cps
#endif // QUTEX_H
@@ -5,10 +5,10 @@
#include <memory>
#include <forward_list>
#include <functional>
#include "spinLock.h"
#include <spinscale/spinLock.h>
namespace sscl {
namespace sscl::cps {
// Forward declarations
class Qutex;
@@ -155,10 +155,10 @@ private:
* Therefore, it's best to use a SpinLock on the history class to avoid
* these coupling issues.
*/
SpinLock acquisitionHistoryLock;
sscl::SpinLock acquisitionHistoryLock;
AcquisitionHistoryMap acquisitionHistory;
};
} // namespace sscl
} // namespace sscl::cps
#endif // QUTEX_ACQUISITION_HISTORY_TRACKER_H
@@ -8,13 +8,13 @@
#include <iostream>
#include <optional>
#include <spinscale/componentThread.h>
#include <spinscale/lockSet.h>
#include <spinscale/asynchronousContinuation.h>
#include <spinscale/lockerAndInvokerBase.h>
#include <spinscale/callback.h>
#include <spinscale/qutexAcquisitionHistoryTracker.h>
#include <spinscale/cps/lockSet.h>
#include <spinscale/cps/asynchronousContinuation.h>
#include <spinscale/cps/lockerAndInvokerBase.h>
#include <spinscale/cps/callback.h>
#include <spinscale/cps/qutexAcquisitionHistoryTracker.h>
namespace sscl {
namespace sscl::cps {
template <class OriginalCbFnT>
class SerializedAsynchronousContinuation
@@ -22,7 +22,7 @@ class SerializedAsynchronousContinuation
{
public:
SerializedAsynchronousContinuation(
const std::shared_ptr<ComponentThread> &caller,
const std::shared_ptr<sscl::ComponentThread> &caller,
Callback<OriginalCbFnT> originalCbFn,
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
: PostedAsynchronousContinuation<OriginalCbFnT>(caller, originalCbFn),
@@ -83,7 +83,7 @@ public:
LockerAndInvoker(
SerializedAsynchronousContinuation<OriginalCbFnT>
&serializedContinuation,
const std::shared_ptr<ComponentThread>& target,
const std::shared_ptr<sscl::ComponentThread>& target,
InvocationTargetT invocationTarget)
: LockerAndInvokerBase(&serializedContinuation),
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
@@ -266,7 +266,7 @@ public:
#endif
SerializedAsynchronousContinuation<OriginalCbFnT>
&serializedContinuation;
std::shared_ptr<ComponentThread> target;
std::shared_ptr<sscl::ComponentThread> target;
InvocationTargetT invocationTarget;
};
};
@@ -470,7 +470,7 @@ template <class InvocationTargetT>
void SerializedAsynchronousContinuation<OriginalCbFnT>
::LockerAndInvoker<InvocationTargetT>::operator()()
{
if (ComponentThread::getSelf() != target)
if (sscl::ComponentThread::getSelf() != target)
{
throw std::runtime_error(
"LockerAndInvoker::operator(): Thread safety violation - "
@@ -588,6 +588,6 @@ void SerializedAsynchronousContinuation<OriginalCbFnT>
invocationTarget();
}
} // namespace sscl
} // namespace sscl::cps
#endif // SERIALIZED_ASYNCHRONOUS_CONTINUATION_H
+6 -6
View File
@@ -5,7 +5,7 @@
#include <functional>
#include <memory>
#include <vector>
#include <spinscale/callback.h>
#include <spinscale/cps/callback.h>
#include <spinscale/componentThread.h>
namespace sscl {
@@ -21,15 +21,15 @@ public:
// Thread management methods
typedef std::function<void()> puppetThreadLifetimeMgmtOpCbFn;
void joltAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
void startAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
void pauseAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
void resumeAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
void exitAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
// CPU distribution method
void distributeAndPinThreadsAcrossCpus();
+3 -3
View File
@@ -1,7 +1,7 @@
#include <spinscale/callableTracer.h>
#include <spinscale/cps/callableTracer.h>
namespace sscl {
namespace sscl::cps {
bool CallableTracer::optTraceCallables = false;
} // namespace sscl
} // namespace sscl::cps
+11 -11
View File
@@ -5,9 +5,9 @@
#include <pthread.h>
#include <sched.h>
#include <boost/asio/io_service.hpp>
#include <spinscale/asynchronousContinuation.h>
#include <spinscale/callback.h>
#include <spinscale/callableTracer.h>
#include <spinscale/cps/asynchronousContinuation.h>
#include <spinscale/cps/callback.h>
#include <spinscale/cps/callableTracer.h>
#include <spinscale/component.h>
#include <spinscale/componentThread.h>
@@ -79,14 +79,14 @@ const std::shared_ptr<ComponentThread> ComponentThread::getSelf(void)
}
class PuppetThread::ThreadLifetimeMgmtOp
: public PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>
: public cps::PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>
{
public:
ThreadLifetimeMgmtOp(
const std::shared_ptr<ComponentThread> &caller,
const std::shared_ptr<PuppetThread> &target,
Callback<threadLifetimeMgmtOpCbFn> callback)
: PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>(
cps::Callback<threadLifetimeMgmtOpCbFn> callback)
: cps::PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>(
caller, callback),
target(target)
{}
@@ -181,7 +181,7 @@ void ComponentThread::cleanup(void)
void PuppetThread::joltThreadReq(
const std::shared_ptr<PuppetThread>& selfPtr,
Callback<threadLifetimeMgmtOpCbFn> callback)
cps::Callback<threadLifetimeMgmtOpCbFn> callback)
{
/** EXPLANATION:
* We can't use shared_from_this() here because JOLTing occurs prior to
@@ -216,7 +216,7 @@ void PuppetThread::joltThreadReq(
}
// Thread management method implementations
void PuppetThread::startThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
void PuppetThread::startThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
{
std::shared_ptr<ComponentThread> caller = getSelf();
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
@@ -229,7 +229,7 @@ void PuppetThread::startThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
request.get(), request)));
}
void PuppetThread::exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
void PuppetThread::exitThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
{
std::shared_ptr<ComponentThread> caller = getSelf();
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
@@ -247,7 +247,7 @@ void PuppetThread::exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
request.get(), request)));
}
void PuppetThread::pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
void PuppetThread::pauseThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
{
if (id == sscl::pptr::puppeteerThreadId)
{
@@ -266,7 +266,7 @@ void PuppetThread::pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
request.get(), request)));
}
void PuppetThread::resumeThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
void PuppetThread::resumeThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
{
if (id == sscl::pptr::puppeteerThreadId)
{
+3 -3
View File
@@ -1,5 +1,5 @@
#include <spinscale/lockerAndInvokerBase.h>
#include <spinscale/cps/lockerAndInvokerBase.h>
namespace sscl {
namespace sscl::cps {
} // namespace sscl
} // namespace sscl::cps
+10 -10
View File
@@ -1,7 +1,7 @@
#include <iostream>
#include <spinscale/asynchronousContinuation.h>
#include <spinscale/cps/asynchronousContinuation.h>
#include <spinscale/asynchronousLoop.h>
#include <spinscale/callback.h>
#include <spinscale/cps/callback.h>
#include <spinscale/puppetApplication.h>
#include <spinscale/componentThread.h>
@@ -14,13 +14,13 @@ PuppetApplication::PuppetApplication(
}
class PuppetApplication::PuppetThreadLifetimeMgmtOp
: public NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>
: public cps::NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>
{
public:
PuppetThreadLifetimeMgmtOp(
PuppetApplication &parent, unsigned int nThreads,
Callback<puppetThreadLifetimeMgmtOpCbFn> callback)
: NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>(callback),
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback)
: cps::NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>(callback),
loop(nThreads),
parent(parent)
{}
@@ -73,7 +73,7 @@ public:
};
void PuppetApplication::joltAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
)
{
if (threadsHaveBeenJolted)
@@ -107,7 +107,7 @@ void PuppetApplication::joltAllPuppetThreadsReq(
}
void PuppetApplication::startAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
)
{
// If no threads, call callback immediately
@@ -131,7 +131,7 @@ void PuppetApplication::startAllPuppetThreadsReq(
}
void PuppetApplication::pauseAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
)
{
// If no threads, call callback immediately
@@ -155,7 +155,7 @@ void PuppetApplication::pauseAllPuppetThreadsReq(
}
void PuppetApplication::resumeAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
)
{
// If no threads, call callback immediately
@@ -179,7 +179,7 @@ void PuppetApplication::resumeAllPuppetThreadsReq(
}
void PuppetApplication::exitAllPuppetThreadsReq(
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
)
{
// If no threads, call callback immediately
+4 -4
View File
@@ -1,7 +1,7 @@
#include <spinscale/qutex.h>
#include <spinscale/lockerAndInvokerBase.h>
#include <spinscale/cps/qutex.h>
#include <spinscale/cps/lockerAndInvokerBase.h>
namespace sscl {
namespace sscl::cps {
bool Qutex::tryAcquire(
const LockerAndInvokerBase &tryingLockvoker, int nRequiredLocks
@@ -377,4 +377,4 @@ void Qutex::release()
front->awaken();
}
} // namespace sscl
} // namespace sscl::cps
+6 -6
View File
@@ -1,14 +1,14 @@
#include <spinscale/qutexAcquisitionHistoryTracker.h>
#include <spinscale/serializedAsynchronousContinuation.h>
#include <spinscale/qutex.h>
#include <spinscale/dependencyGraph.h>
#include <spinscale/cps/qutexAcquisitionHistoryTracker.h>
#include <spinscale/cps/serializedAsynchronousContinuation.h>
#include <spinscale/cps/qutex.h>
#include <spinscale/cps/dependencyGraph.h>
#include <memory>
#include <forward_list>
#include <functional>
#include <iostream>
#include <algorithm>
namespace sscl {
namespace sscl::cps {
void DependencyGraph::addNode(const Node& node)
{
@@ -390,4 +390,4 @@ bool QutexAcquisitionHistoryTracker
return true;
}
} // namespace sscl
} // namespace sscl::cps