&contentdata
section_name = 'home'
page_name = 'process_list'
author = 'mrmt32'
type = 'page'
>
Running Processes
| PID | Name | User ID | Mem. Usage | Run State | Priority |
<&javascript>
SendCommandToServer({action:'get_value', type:'current', name:'processList'}, function(jsonResponse)
{
if (jsonResponse.isError)
{
$("#connection_details").html(jsonResponse.ErrorString);
}
else
{
var i = 0;
var totalMem = 0;
for (processId in jsonResponse.ReturnData.processList)
{
var process = jsonResponse.ReturnData.processList[processId];
$("#process_list").append(""
+ "| " + process.Pid + " | "
+ "" + process.CommandLine + " | "
+ "" + process.UserId + " | "
+ "" + process.VmSize + " | "
+ "" + process.RunState + " | "
+ "" + process.Priority + " | "
+ "
");
// Load detailed process info dialog
var tempFunction = function(pid)
{
$("#process" + i).click(function()
{
SendCommandToServer({action:'get_value', type:'current', name:'detailedProcessInfo:' + pid}, function(jsonResponse)
{
if (jsonResponse.isError)
{
$("#processDialog").html(jsonResponse.ErrorString);
$("#processDialog").dialog(
{
modal: true,
close: function() { $(this).dialog('destroy') },
width: 300,
buttons: { "OK": function() { $(this).dialog("close"); } }
});
}
else
{
var process = jsonResponse.ReturnData['detailedProcessInfo:' + pid];
if (process.CommandLine == "" && process.Name == "")
{
$("#processDialog").html("Process no longer exists!");
$("#processDialog").dialog(
{
modal: true,
close: function() { $(this).dialog('destroy') },
width: 300,
buttons: { "OK": function() { $(this).dialog("close"); } }
});
}
else
{
var environmentString = "";
for (variableName in process.Environment)
{
environmentString += variableName + " = " + process.Environment[variableName] + "
";
}
parameters =
{
processId: process.Pid,
processName: process.Name,
commandLine: process.CommandLine,
vmSize: process.VmSize,
vmRSS: process.VmRSS,
vmExe: process.VmExe,
vmLib: process.VmLib,
vmStk: process.VmStk,
threadCount: process.Threads,
sleepTime: process.SleepAverage,
runState: process.RunState,
environment: environmentString
};
ParseContentData(window.ContentData.blocks.process_information_block, parameters, function(output)
{
$("#processDialog").html(output);
$("#processDialog").dialog(
{
modal: true,
close: function() { $(this).dialog('destroy') },
width: 450,
buttons:
{
"OK": function()
{
$(this).dialog("close");
},
"Kill Process": function()
{
$.post(InterfaceLocation + "?action=kill_process", {pid: pid}, function(jsonResponse)
{
if (jsonResponse.isError)
{
alert("Error killing process: " + jsonResponse.ErrorString);
}
else
{
alert("Process with PID '" + pid + "' killed.");
}
});
$(this).dialog("close");
}
}
});
});
}
}
});
});
}
tempFunction(process.Pid);
totalMem += process.VmSize;
i++;
}
// Load overview table
parameters =
{
totalMemoryUsage: totalMem,
totalMemoryUsagePercent: Math.round((totalMem * 100) / 13352 * 100) / 100,
processesCount: i
};
ParseContentData(window.ContentData.blocks.process_overview_block, parameters, function(output)
{
$("#processOverview").html(output);
});
}
});
<&/javascript>
<&/contentdata>
<&contentdata
block_name = 'process_overview_block'
author = 'mrmt32'
type = 'block'
>
| Total Memory Allocation: | <$totalMemoryUsage> KB (<$totalMemoryUsagePercent>%) |
| Running Processes: | <$processesCount> |
<&/contentdata>
<&contentdata
block_name = 'process_information_block'
author = 'mrmt32'
type = 'block'
>
| Process ID | <$processId> |
| Process Name | <$processName> |
| Command Line | <$commandLine> |
| VmSize | <$vmSize> KB |
| VmRSS | <$vmRSS> KB |
| VmExe | <$vmExe> KB |
| VmLib | <$vmLib> KB |
| VmStk | <$vmStk> KB |
| Threads | <$threadCount> |
| Avg Sleep Time | <$sleepTime>% |
| Run State | <$runState> |
| Environment | <$environment> |
<&/contentdata>