Skip to content

Commit 6884b81

Browse files
nephrosnephros
authored andcommitted
Hotcache: Prepare for stats collecting
1 parent 3fd441c commit 6884b81

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/bin/patchmanager-daemon/patchmanagerobject.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,3 +3075,7 @@ void PatchManagerFilter::setup()
30753075
}
30763076
}
30773077
}
3078+
3079+
QList<QPair<QString, QVariant>> PatchManagerFilter::stats() const
3080+
{
3081+
}

src/bin/patchmanager-daemon/patchmanagerobject.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ class PatchManagerFilter : public QObject, public QCache<QString, QObject>
7979
{
8080
Q_OBJECT
8181
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
82+
Q_PROPERTY(unsigned int hits READ hits)
83+
Q_PROPERTY(unsigned int misses READ misses)
8284
public:
8385
PatchManagerFilter(QObject *parent = nullptr, int maxCost = 100);
8486
//~PatchManagerFilter();
@@ -97,11 +99,20 @@ class PatchManagerFilter : public QObject, public QCache<QString, QObject>
9799
void setActive(bool active) { m_active = active; emit activeChanged(active); };
98100
bool active() const { return m_active; };
99101

102+
void hit() { m_hits++; };
103+
void miss() { m_misses++; };
104+
unsigned int hits() const { return m_hits; };
105+
unsigned int misses() const { return m_misses; };
106+
107+
QList<QPair<QString, QVariant>> stats() const;
108+
100109
signals:
101110
void activeChanged(bool);
102111

103112
private:
104113
bool m_active;
114+
unsigned int m_hits = 0;
115+
unsigned int m_misses = 0;
105116
};
106117

107118
class PatchManagerObject : public QObject, public QDBusContext

0 commit comments

Comments
 (0)