Browse files

code style is up to Coding Standards

  • Loading branch information...
1 parent 322021c commit 12cc4cdcc40624ae73b0515e330f5bf0ffbf8b76 @kuzmas committed Oct 21, 2012
View
3 libraries/sysstat/CMakeLists.txt
@@ -9,8 +9,7 @@ set (PATCH_VERSION 0)
add_definitions(-DMAJOR_VERSION=${MAJOR_VERSION})
add_definitions(-DMINOR_VERSION=${MINOR_VERSION})
add_definitions(-DPATCH_VERSION=${PATCH_VERSION})
-
-include_directories( .. )
+add_definitions(-DSYSSTAT_LIBRARY)
add_definitions(-Wall)
find_package(Qt4 REQUIRED)
View
45 libraries/sysstat/basestat.cpp
@@ -34,14 +34,13 @@ namespace SysStat {
BaseStatPrivate::BaseStatPrivate(BaseStat* parent)
: QObject(parent)
- , iface(parent)
- , m_timer(new QTimer(this))
- , m_synchroTimer(new QTimer(this))
+ , mTimer(new QTimer(this))
+ , mSynchroTimer(new QTimer(this))
{
- m_timer->setSingleShot(false);
+ mTimer->setSingleShot(false);
- m_synchroTimer->setSingleShot(false);
- connect(m_synchroTimer, SIGNAL(timeout()), SLOT(synchroTimeout()));
+ mSynchroTimer->setSingleShot(false);
+ connect(mSynchroTimer, SIGNAL(timeout()), SLOT(synchroTimeout()));
}
BaseStatPrivate::~BaseStatPrivate()
@@ -50,56 +49,56 @@ BaseStatPrivate::~BaseStatPrivate()
bool BaseStatPrivate::timerIsActive(void) const
{
- return m_timer->isActive();
+ return mTimer->isActive();
}
int BaseStatPrivate::updateInterval(void) const
{
- return m_timer->interval();
+ return mTimer->interval();
}
void BaseStatPrivate::setUpdateInterval(int msec)
{
- m_timer->stop();
- m_timer->setInterval(msec);
- m_synchroTimer->setInterval(msec / 10);
+ mTimer->stop();
+ mTimer->setInterval(msec);
+ mSynchroTimer->setInterval(msec / 10);
if (msec > 0)
{
- m_lastSynchro = 0;
- m_synchroTimer->start();
+ mLastSynchro = 0;
+ mSynchroTimer->start();
}
}
void BaseStatPrivate::synchroTimeout(void)
{
QTime now(QTime::currentTime());
- int synchro = ((now.minute() * 60 + now.second()) * 1000 + now.msec() ) / m_timer->interval();
- if ((m_lastSynchro != 0) && (m_lastSynchro != synchro))
+ int synchro = ((now.minute() * 60 + now.second()) * 1000 + now.msec() ) / mTimer->interval();
+ if ((mLastSynchro != 0) && (mLastSynchro != synchro))
{
- m_synchroTimer->stop();
- m_timer->start();
+ mSynchroTimer->stop();
+ mTimer->start();
}
- m_lastSynchro = synchro;
+ mLastSynchro = synchro;
}
void BaseStatPrivate::stopUpdating(void)
{
- m_timer->stop();
+ mTimer->stop();
}
QString BaseStatPrivate::monitoredSource(void) const
{
- return m_source;
+ return mSource;
}
void BaseStatPrivate::setMonitoredSource(const QString &Source)
{
- m_source = Source;
+ mSource = Source;
}
void BaseStatPrivate::monitorDefaultSource(void)
{
- m_source = defaultSource();
+ mSource = defaultSource();
}
QString BaseStatPrivate::readAllFile(const char *filename)
@@ -123,7 +122,7 @@ QString BaseStatPrivate::readAllFile(const char *filename)
QStringList BaseStatPrivate::sources(void) const
{
- return m_sources;
+ return mSources;
}
BaseStat::BaseStat(QObject *parent)
View
12 libraries/sysstat/basestat_p.hpp
@@ -61,16 +61,14 @@ private slots:
protected:
virtual QString defaultSource(void) = 0;
- BaseStat * const iface;
-
QString readAllFile(const char *filename);
- QTimer *m_timer;
- QTimer *m_synchroTimer;
- QString m_source;
- QStringList m_sources;
+ QTimer *mTimer;
+ QTimer *mSynchroTimer;
+ QString mSource;
+ QStringList mSources;
- int m_lastSynchro;
+ int mLastSynchro;
};
}
View
50 libraries/sysstat/cpustat.cpp
@@ -29,11 +29,11 @@ namespace SysStat {
CpuStatPrivate::CpuStatPrivate(CpuStat *parent)
: BaseStatPrivate(parent)
- , m_monitoring(CpuStat::LoadAndFrequency)
+ , mMonitoring(CpuStat::LoadAndFrequency)
{
- m_source = defaultSource();
+ mSource = defaultSource();
- connect(m_timer, SIGNAL(timeout()), SLOT(timeout()));
+ connect(mTimer, SIGNAL(timeout()), SLOT(timeout()));
updateSources();
}
@@ -47,13 +47,13 @@ void CpuStatPrivate::addSource(const QString &source)
{
uint max = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_max_freq").arg(source))).toUInt(&ok);
if (ok)
- m_bounds[source] = qMakePair(min, max);
+ mBounds[source] = qMakePair(min, max);
}
}
void CpuStatPrivate::updateSources(void)
{
- m_sources.clear();
+ mSources.clear();
foreach (QString row, readAllFile("/proc/stat").split(QChar('\n'), QString::SkipEmptyParts))
{
@@ -62,10 +62,10 @@ void CpuStatPrivate::updateSources(void)
|| (!tokens[0].startsWith("cpu")) )
continue;
- m_sources.append(tokens[0]);
+ mSources.append(tokens[0]);
}
- m_bounds.clear();
+ mBounds.clear();
bool ok;
@@ -98,8 +98,8 @@ CpuStatPrivate::~CpuStatPrivate()
void CpuStatPrivate::timeout(void)
{
- if ( (m_monitoring == CpuStat::LoadOnly)
- || (m_monitoring == CpuStat::LoadAndFrequency) )
+ if ( (mMonitoring == CpuStat::LoadOnly)
+ || (mMonitoring == CpuStat::LoadAndFrequency) )
{
foreach (QString row, readAllFile("/proc/stat").split(QChar('\n'), QString::SkipEmptyParts))
{
@@ -120,27 +120,27 @@ void CpuStatPrivate::timeout(void)
current.other += tokens[i].toULongLong();
current.sum();
- if (!m_previous.contains(cpuName))
- m_previous.insert(cpuName, Values());
- const Values &previous = m_previous[cpuName];
+ if (!mPrevious.contains(cpuName))
+ mPrevious.insert(cpuName, Values());
+ const Values &previous = mPrevious[cpuName];
- if (cpuName == m_source)
+ if (cpuName == mSource)
{
float sumDelta = static_cast<float>(current.total - previous.total);
- if (m_monitoring == CpuStat::LoadAndFrequency)
+ if (mMonitoring == CpuStat::LoadAndFrequency)
{
bool ok;
float freqRate = 1.0;
uint freq = 0;
- if (m_source == "cpu")
+ if (mSource == "cpu")
{
uint count = 0;
freqRate = 0.0;
- for (Bounds::ConstIterator I = m_bounds.constBegin(); I != m_bounds.constEnd(); ++I)
+ for (Bounds::ConstIterator I = mBounds.constBegin(); I != mBounds.constEnd(); ++I)
{
uint thisFreq = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_cur_freq").arg(I.key()))).toUInt(&ok);
@@ -161,12 +161,12 @@ void CpuStatPrivate::timeout(void)
}
else
{
- freq = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_cur_freq").arg(m_source))).toUInt(&ok);
+ freq = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_cur_freq").arg(mSource))).toUInt(&ok);
if (ok)
{
- Bounds::ConstIterator I = m_bounds.constFind(m_source);
- if (I != m_bounds.constEnd())
+ Bounds::ConstIterator I = mBounds.constFind(mSource);
+ if (I != mBounds.constEnd())
freqRate = static_cast<float>(freq) / static_cast<float>(I.value().second);
}
}
@@ -189,19 +189,19 @@ void CpuStatPrivate::timeout(void)
}
}
- m_previous[cpuName] = current;
+ mPrevious[cpuName] = current;
}
}
else
{
bool ok;
uint freq = 0;
- if (m_source == "cpu")
+ if (mSource == "cpu")
{
uint count = 0;
- for (Bounds::ConstIterator I = m_bounds.constBegin(); I != m_bounds.constEnd(); ++I)
+ for (Bounds::ConstIterator I = mBounds.constBegin(); I != mBounds.constEnd(); ++I)
{
uint thisFreq = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_cur_freq").arg(I.key()))).toUInt(&ok);
@@ -218,7 +218,7 @@ void CpuStatPrivate::timeout(void)
}
else
{
- freq = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_cur_freq").arg(m_source))).toUInt(&ok);
+ freq = readAllFile(qPrintable(QString("/sys/devices/system/cpu/%1/cpufreq/scaling_cur_freq").arg(mSource))).toUInt(&ok);
}
emit update(freq);
}
@@ -246,12 +246,12 @@ void CpuStatPrivate::Values::sum(void)
CpuStat::Monitoring CpuStatPrivate::monitoring(void) const
{
- return m_monitoring;
+ return mMonitoring;
}
void CpuStatPrivate::setMonitoring(CpuStat::Monitoring value)
{
- m_monitoring = value;
+ mMonitoring = value;
}
CpuStat::CpuStat(QObject *parent)
View
6 libraries/sysstat/cpustat_p.hpp
@@ -76,12 +76,12 @@ private slots:
void sum(void);
} Values;
typedef QMap<QString, Values> NamedValues;
- NamedValues m_previous;
+ NamedValues mPrevious;
- CpuStat::Monitoring m_monitoring;
+ CpuStat::Monitoring mMonitoring;
typedef QMap<QString, QPair<uint, uint> > Bounds;
- Bounds m_bounds;
+ Bounds mBounds;
void addSource(const QString &source);
};
View
10 libraries/sysstat/memstat.cpp
@@ -30,11 +30,11 @@ namespace SysStat {
MemStatPrivate::MemStatPrivate(MemStat *parent)
: BaseStatPrivate(parent)
{
- m_source = defaultSource();
+ mSource = defaultSource();
- connect(m_timer, SIGNAL(timeout()), SLOT(timeout()));
+ connect(mTimer, SIGNAL(timeout()), SLOT(timeout()));
- m_sources << "memory" << "swap";
+ mSources << "memory" << "swap";
}
MemStatPrivate::~MemStatPrivate()
@@ -70,7 +70,7 @@ void MemStatPrivate::timeout(void)
swapFree = tokens[1].toULong();
}
- if (m_source == "memory")
+ if (mSource == "memory")
{
if (memTotal)
{
@@ -82,7 +82,7 @@ void MemStatPrivate::timeout(void)
emit memoryUpdate(applications_d, buffers_d, cached_d);
}
}
- else if (m_source == "swap")
+ else if (mSource == "swap")
{
if (swapTotal)
{
View
18 libraries/sysstat/netstat.cpp
@@ -30,9 +30,9 @@ namespace SysStat {
NetStatPrivate::NetStatPrivate(NetStat *parent)
: BaseStatPrivate(parent)
{
- m_source = defaultSource();
+ mSource = defaultSource();
- connect(m_timer, SIGNAL(timeout()), SLOT(timeout()));
+ connect(mTimer, SIGNAL(timeout()), SLOT(timeout()));
QStringList rows(readAllFile("/proc/net/dev").split(QChar('\n'), QString::SkipEmptyParts));
@@ -45,7 +45,7 @@ NetStatPrivate::NetStatPrivate(NetStat *parent)
if (tokens.size() != 2)
continue;
- m_sources.append(tokens[0].trimmed());
+ mSources.append(tokens[0].trimmed());
}
}
@@ -87,14 +87,14 @@ void NetStatPrivate::timeout(void)
current.received = data[receivedIndex ].toULongLong();
current.transmitted = data[transmittedIndex].toULongLong();
- if (!m_previous.contains(interfaceName))
- m_previous.insert(interfaceName, Values());
- const Values &previous = m_previous[interfaceName];
+ if (!mPrevious.contains(interfaceName))
+ mPrevious.insert(interfaceName, Values());
+ const Values &previous = mPrevious[interfaceName];
- if (interfaceName == m_source)
- emit update((( current.received - previous.received ) * 1000 ) / m_timer->interval(), (( current.transmitted - previous.transmitted ) * 1000 ) / m_timer->interval());
+ if (interfaceName == mSource)
+ emit update((( current.received - previous.received ) * 1000 ) / mTimer->interval(), (( current.transmitted - previous.transmitted ) * 1000 ) / mTimer->interval());
- m_previous[interfaceName] = current;
+ mPrevious[interfaceName] = current;
}
}
View
2 libraries/sysstat/netstat_p.hpp
@@ -60,7 +60,7 @@ private slots:
qulonglong transmitted;
} Values;
typedef QMap<QString, Values> NamedValues;
- NamedValues m_previous;
+ NamedValues mPrevious;
};
}

0 comments on commit 12cc4cd

Please sign in to comment.