mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 08:26:02 +00:00
Guard the statistics table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73916 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
|
#include "llvm/System/Mutex.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
@@ -57,13 +58,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ManagedStatic<StatisticInfo> StatInfo;
|
static ManagedStatic<StatisticInfo> StatInfo;
|
||||||
|
static ManagedStatic<sys::Mutex> StatLock;
|
||||||
|
|
||||||
/// RegisterStatistic - The first time a statistic is bumped, this method is
|
/// RegisterStatistic - The first time a statistic is bumped, this method is
|
||||||
/// called.
|
/// called.
|
||||||
void Statistic::RegisterStatistic() {
|
void Statistic::RegisterStatistic() {
|
||||||
// If stats are enabled, inform StatInfo that this statistic should be
|
// If stats are enabled, inform StatInfo that this statistic should be
|
||||||
// printed.
|
// printed.
|
||||||
|
sys::ScopedLock Writer(&*StatLock);
|
||||||
if (Enabled)
|
if (Enabled)
|
||||||
StatInfo->addStatistic(this);
|
StatInfo->addStatistic(this);
|
||||||
// Remember we have been registered.
|
// Remember we have been registered.
|
||||||
|
Reference in New Issue
Block a user