Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class TopComponent extends React.Component {
renderGraph() {
const rows = this.state.data.map(function (row, i) {
const styleLoad = { width: `${row.loadPercent}%` };
const styleLoadR = { width: `${row.loadPercentR}%` };
const styleLoadW = { width: `${row.loadPercentW}%` };
const styleLoadR = { width: `${row.loadPercentRead}%` };
const styleLoadW = { width: `${row.loadPercentWrite}%` };

return (
<li className="rt-lists__item" key={`list-item-${i}`}>
Expand Down
24 changes: 15 additions & 9 deletions packages/compass-serverstats/src/stores/top-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ const TopStore = Reflux.createStore({
debug('Error: top response from DB missing fields', value);
}
t2s[collname] = {
loadPercentR: value.readLock.time,
loadPercentL: value.writeLock.time,
loadPercentRead: value.readLock.time,
loadPercentWrite: value.writeLock.time,
loadPercent: value.total.time,
};
}
Expand All @@ -171,25 +171,31 @@ const TopStore = Reflux.createStore({
const t1 =
collname in this.t1s
? this.t1s[collname]
: { loadPercent: 0, loadPercentR: 0, loadPercentL: 0 };
: { loadPercent: 0, loadPercentRead: 0, loadPercentWrite: 0 };
const t2 = t2s[collname];

const tDelta = t2.loadPercent - t1.loadPercent;

const loadL =
const loadWrite =
tDelta === 0
? 0
: round(((t2.loadPercentL - t1.loadPercentL) / tDelta) * 100, 0);
const loadR =
: round(
((t2.loadPercentWrite - t1.loadPercentWrite) / tDelta) * 100,
0
);
const loadRead =
tDelta === 0
? 0
: round(((t2.loadPercentR - t1.loadPercentR) / tDelta) * 100, 0);
: round(
((t2.loadPercentRead - t1.loadPercentRead) / tDelta) * 100,
0
);

totals.push({
collectionName: collname,
loadPercent: round((tDelta * 100) / (cadence * numCores), 2), // System load.
loadPercentR: loadR,
loadPercentL: loadL,
loadPercentRead: loadRead,
loadPercentWrite: loadWrite,
});
}
this.t1s = t2s;
Expand Down
Loading