Skip to content

Commit c93ddf0

Browse files
committed
Fix file write stats
1 parent 919a303 commit c93ddf0

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/extension.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as ps from "node-ps-data";
33
import { join } from "path";
44
import * as vscode from "vscode";
55

6-
var webview: vscode.Webview;
6+
var webview: vscode.Webview | undefined = undefined;
77
var pollingInterval = 100;
88
var rsmLength = 10000;
99

@@ -68,7 +68,7 @@ class PyDebugAdapterTracker implements vscode.DebugAdapterTracker {
6868
// https://microsoft.github.io/debug-adapter-protocol//specification.html#Events_Process
6969
// New process spawned, start monitoring pid and open/reuse webview
7070
if (pidMonitors.size === 0) {
71-
webview.postMessage({ type: "reset" });
71+
webview?.postMessage({ type: "reset" });
7272
}
7373
const pid = message.body.systemProcessId;
7474
startMonitor(pid);
@@ -185,7 +185,7 @@ export function activate(context: vscode.ExtensionContext) {
185185
let rsmLengthRepr =
186186
rsmLength === 0 ? "unlimited" : `${rsmLength}ms`;
187187
try {
188-
await webview.postMessage({
188+
await webview?.postMessage({
189189
type: "length",
190190
value: num,
191191
});
@@ -250,9 +250,7 @@ async function postData(
250250
try {
251251
// Make sure to catch promise rejections (when the webview has been closed but a message is still posted) with
252252
// .then()
253-
await webview
254-
.postMessage({ pid: pid, type: key, time: time, value: value })
255-
.then(nop, nop);
253+
await webview?.postMessage({ pid, type: key, time, value });
256254
} catch {
257255
console.error(
258256
"Webview post failed. May be due to process interval not yet being closed."

webview/panel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ function updateCpu() {
313313
}
314314

315315
function updateFileRead() {
316-
let maxFile = 0;
316+
let maxFile = 8;
317317
let minTime = Number.MAX_SAFE_INTEGER;
318318
let maxTime = 0;
319319
let findmax = (value, key) => {
@@ -341,7 +341,7 @@ function updateFileRead() {
341341
}
342342

343343
function updateFileWrite() {
344-
let maxFile = 0;
344+
let maxFile = 8;
345345
let minTime = Number.MAX_SAFE_INTEGER;
346346
let maxTime = 0;
347347
let findmax = (value, key) => {
@@ -365,7 +365,7 @@ function updateFileWrite() {
365365
pidMonitor.filewrite.forEach(prune);
366366
}
367367
});
368-
updateGraph(fileWriteCanvas, minTime, maxTime, 10, timeUnits, 0, maxFile, 5, memUnits, 'filewrite');
368+
updateGraph(fileWriteCanvas, timeAxis(minTime, maxTime), memAxis(maxFile), 'filewrite');
369369
}
370370

371371
class Message {

0 commit comments

Comments
 (0)