Skip to content

Commit 0bcc41d

Browse files
committed
Add FileIO data
File read and file write for the process
1 parent 9f4ac71 commit 0bcc41d

10 files changed

+176
-116
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
out/
3+
test_docs/data.txt
34
*.vsix

.vscodeignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.vscode/**
22
.vscode-test/**
33
out/test/**
4+
test_docs/**
45

56
src/**
67
.gitignore

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ All notable changes to the Python Resource Monitor extension will be documented
4040
- With the new update of `node-ps-data` ensuring consistency in memory results on Windows, we no longer use the `tasklist` shell command except as a fallback, and prefer `node-ps-data`.
4141

4242
## 0.1.9 - Alpha
43-
- Add [Patreon](https://www.patreon.com/bePatron?u=9073173) link
43+
- Add [Patreon](https://www.patreon.com/bePatron?u=9073173) link
44+
45+
## 0.2.0 - Beta
46+
- Add file read and write data.

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ Native addon build now includes binaries.
5454

5555
### 0.1.4
5656

57-
Improved flexibility of displays.
57+
Improved flexibility of displays.
58+
59+
### 0.2.0
60+
61+
Added file IO data.

package-lock.json

+37-37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "python-resource-monitor",
33
"displayName": "Python Resource Monitor",
44
"description": "A resource monitor for the Python Debugger",
5-
"version": "0.1.9",
5+
"version": "0.2.0",
66
"publisher": "kaih2o",
77
"contributors": [
88
"2kai2kai2",
@@ -14,7 +14,7 @@
1414
"vscode.python"
1515
],
1616
"engines": {
17-
"vscode": "^1.56.0"
17+
"vscode": "^1.60.0"
1818
},
1919
"categories": [
2020
"Visualization",
@@ -79,6 +79,6 @@
7979
"vscode-test": "^1.6.1"
8080
},
8181
"dependencies": {
82-
"node-ps-data": "^1.1.1"
82+
"node-ps-data": "^1.3.0"
8383
}
8484
}

src/extension.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ async function launchWebview(context: vscode.ExtensionContext, pid: number) {
3737
let paneljs = panel.webview.asWebviewUri(
3838
vscode.Uri.file(join(context.extensionPath, "webview", "panel.js"))
3939
);
40-
let plotlyjs = panel.webview.asWebviewUri(
41-
vscode.Uri.file(join(context.extensionPath, "webview", "plotly.js"))
42-
);
4340
panel.webview.html = `
4441
<html lang="en">
4542
<head>
@@ -59,12 +56,16 @@ async function launchWebview(context: vscode.ExtensionContext, pid: number) {
5956
<div style="width: 100%; max-height: 150px; margin: 0 auto;">
6057
<canvas id="cpu" style="width: 100%; height: 100%;"></canvas>
6158
</div>
59+
<h3 id="fileiotitle">File Usage</h3>
60+
<p style="color: --vscode-terminal-ansiGreen">Read</p>
61+
<div style="width: 100%; max-height: 150px; margin: 0 auto;">
62+
<canvas id="fileio" style="width: 100%; height: 100%;"></canvas>
63+
</div>
6264
<a href="https://www.patreon.com/bePatron?u=9073173">
6365
<img src="https://img.shields.io/badge/Patreon-donate-orange?logo=Patreon">
6466
</a>
6567
</div>
6668
<script src="${paneljs}"></script>
67-
<script src="${plotlyjs}"></script>
6869
</body>
6970
</html>
7071
`;
@@ -250,7 +251,7 @@ export function activate(context: vscode.ExtensionContext) {
250251
* @param time Timestamp for the data value.
251252
* @param value Value of data.
252253
*/
253-
function postData(key: "memdata" | "cpudata", time: number, value: number) {
254+
function postData(key: "memdata" | "cpudata" | "readdata" | "writedata", time: number, value: number) {
254255
try {
255256
// Make sure to catch promise rejections (when the webview has been closed but a message is still posted) with .then()
256257
panel.webview
@@ -275,9 +276,15 @@ function getData(pid: number) {
275276
let timecpu = Date.now();
276277
let mem = ps.memInfo(pid);
277278
let timemem = Date.now();
279+
let read = ps.fileRead(pid);
280+
let timeread = Date.now();
281+
let write = ps.fileWrite(pid);
282+
let timewrite = Date.now();
278283
// Send data to webview
279284
postData("memdata", timemem, mem);
280285
postData("cpudata", timecpu, cpu);
286+
postData("readdata", timeread, read);
287+
postData("writedata", timewrite, write);
281288
}
282289

283290
/**

webview/panel.html

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ <h3 id="cputitle">CPU Usage</h3>
2020
<div style="width: 100%; max-height: 150px; margin: 0 auto;">
2121
<canvas id="cpu" style="width: 100%; height: 100%;"></canvas>
2222
</div>
23+
<h3 id="fileiotitle">File Usage</h3>
24+
<p style="color: --vscode-terminal-ansiGreen">Read</p>
25+
<div style="width: 100%; max-height: 150px; margin: 0 auto;">
26+
<canvas id="fileio" style="width: 100%; height: 100%;"></canvas>
27+
</div>
2328
<a href="https://www.patreon.com/bePatron?u=9073173">
2429
<img src="https://img.shields.io/badge/Patreon-donate-orange?logo=Patreon">
2530
</a>

0 commit comments

Comments
 (0)