9p stats: Show file in progress after parallel operation finishes

This commit is contained in:
Fabian 2020-12-31 19:14:34 -06:00
parent 1d2be8a04f
commit ac9d248c85
2 changed files with 23 additions and 6 deletions

View file

@ -628,6 +628,7 @@ Virtio9p.prototype.ReceiveRequest = async function (bufchain) {
var count = req[2];
const filename = this.fids[fid].dbg_name;
message.Debug("[write]: fid=" + fid + " (" + filename + ") offset=" + offset + " count=" + count + " fidtype=" + this.fids[fid].type);
if(this.fids[fid].type === FID_XATTR)
{

View file

@ -1442,27 +1442,43 @@
var stats_9p = {
read: 0,
write: 0,
files: [],
};
emulator.add_listener("9p-read-start", function()
emulator.add_listener("9p-read-start", function(args)
{
const file = args[0];
stats_9p.files.push(file);
$("info_filesystem").style.display = "block";
$("info_filesystem_status").textContent = "Loading ...";
$("info_filesystem_last_file").textContent = file;
});
emulator.add_listener("9p-read-end", function(args)
{
stats_9p.read += args[1];
$("info_filesystem_status").textContent = "Idle";
$("info_filesystem_last_file").textContent = args[0];
$("info_filesystem_bytes_read").textContent = stats_9p.read;
const file = args[0];
stats_9p.files = stats_9p.files.filter(f => f !== file);
if(stats_9p.files[0])
{
$("info_filesystem_last_file").textContent = stats_9p.files[0];
}
else
{
$("info_filesystem_status").textContent = "Idle";
}
});
emulator.add_listener("9p-write-end", function(args)
{
stats_9p.write += args[1];
$("info_filesystem_last_file").textContent = args[0];
$("info_filesystem_bytes_written").textContent = stats_9p.write;
if(!stats_9p.files[0])
{
$("info_filesystem_last_file").textContent = args[0];
}
});
var stats_storage = {