Internals: Rename threadsInModel()
This commit is contained in:
parent
39ee522f92
commit
e390d6779d
|
|
@ -2584,7 +2584,7 @@ void VerilatedContext::printStatsSummary() VL_MT_UNSAFE {
|
||||||
simtime.c_str(), walltime, simtimePerf.c_str());
|
simtime.c_str(), walltime, simtimePerf.c_str());
|
||||||
const double modelMB = VlOs::memUsageBytes() / 1024.0 / 1024.0;
|
const double modelMB = VlOs::memUsageBytes() / 1024.0 / 1024.0;
|
||||||
VL_PRINTF("- Verilator: cpu %0.3f s on %d threads; alloced %0.0f MB\n", cputime,
|
VL_PRINTF("- Verilator: cpu %0.3f s on %d threads; alloced %0.0f MB\n", cputime,
|
||||||
modelThreads(), modelMB);
|
threadsInModels(), modelMB);
|
||||||
}
|
}
|
||||||
void VerilatedContext::quiet(bool flag) VL_MT_SAFE {
|
void VerilatedContext::quiet(bool flag) VL_MT_SAFE {
|
||||||
const VerilatedLockGuard lock{m_mutex};
|
const VerilatedLockGuard lock{m_mutex};
|
||||||
|
|
@ -2666,7 +2666,7 @@ void VerilatedContext::addModel(VerilatedModel* modelp) {
|
||||||
}
|
}
|
||||||
threadPoolp(); // Ensure thread pool is created, so m_threads cannot change any more
|
threadPoolp(); // Ensure thread pool is created, so m_threads cannot change any more
|
||||||
|
|
||||||
m_modelThreads += modelp->threads();
|
m_threadsInModels += modelp->threads();
|
||||||
if (VL_UNLIKELY(modelp->threads() > m_threads)) {
|
if (VL_UNLIKELY(modelp->threads() > m_threads)) {
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "VerilatedContext has " << m_threads << " threads but model '"
|
msg << "VerilatedContext has " << m_threads << " threads but model '"
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,7 @@ protected:
|
||||||
// Number of threads to use for simulation (size of m_threadPool + 1 for main thread)
|
// Number of threads to use for simulation (size of m_threadPool + 1 for main thread)
|
||||||
unsigned m_threads = std::thread::hardware_concurrency();
|
unsigned m_threads = std::thread::hardware_concurrency();
|
||||||
// Number of threads in added models
|
// Number of threads in added models
|
||||||
unsigned m_modelThreads = 0;
|
unsigned m_threadsInModels = 0;
|
||||||
// The thread pool shared by all models added to this context
|
// The thread pool shared by all models added to this context
|
||||||
std::unique_ptr<VerilatedVirtualBase> m_threadPool;
|
std::unique_ptr<VerilatedVirtualBase> m_threadPool;
|
||||||
// The execution profiler shared by all models added to this context
|
// The execution profiler shared by all models added to this context
|
||||||
|
|
@ -561,7 +561,7 @@ public:
|
||||||
/// Get number of threads used for simulation (including the main thread)
|
/// Get number of threads used for simulation (including the main thread)
|
||||||
unsigned threads() const { return m_threads; }
|
unsigned threads() const { return m_threads; }
|
||||||
/// Get number of threads in added models (for statistical use only)
|
/// Get number of threads in added models (for statistical use only)
|
||||||
unsigned modelThreads() const { return m_modelThreads; }
|
unsigned threadsInModels() const { return m_threadsInModels; }
|
||||||
/// Set number of threads used for simulation (including the main thread)
|
/// Set number of threads used for simulation (including the main thread)
|
||||||
/// Can only be called before the thread pool is created (before first model is added).
|
/// Can only be called before the thread pool is created (before first model is added).
|
||||||
void threads(unsigned n);
|
void threads(unsigned n);
|
||||||
|
|
@ -589,8 +589,8 @@ public:
|
||||||
return reinterpret_cast<const VerilatedContextImp*>(this);
|
return reinterpret_cast<const VerilatedContextImp*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Internal: Model and thread setup
|
||||||
void addModel(VerilatedModel*);
|
void addModel(VerilatedModel*);
|
||||||
|
|
||||||
VerilatedVirtualBase* threadPoolp();
|
VerilatedVirtualBase* threadPoolp();
|
||||||
void prepareClone();
|
void prepareClone();
|
||||||
VerilatedVirtualBase* threadPoolpOnClone();
|
VerilatedVirtualBase* threadPoolpOnClone();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue