01: package tide.execute;
02:
03: import snow.utils.storage.FileUtils;
04:
05: /** A system process.
06: */
07: public final class SProcess {
08: String name;
09: String pid;
10: // as get with tasklist /SVC
11: String services;
12: long memory = -1;
13:
14: public SProcess(String name, String pid, long memory) {
15: this .name = name;
16: this .pid = pid;
17: this .memory = memory;
18: }
19:
20: public String getName() {
21: return toStringForPM();
22: }
23:
24: public String getPid() {
25: return pid;
26: }
27:
28: public long getMemory() {
29: return memory;
30: }
31:
32: @Override
33: public final String toString() {
34: StringBuilder sb = new StringBuilder();
35: sb.append("System process: " + name + " (id=" + pid + ", mem="
36: + FileUtils.formatSize(memory) + ", svc=" + services
37: + ")");
38: return sb.toString();
39: }
40:
41: public final String toStringForPM() {
42: StringBuilder sb = new StringBuilder();
43: sb.append("System process: " + name);
44: if (services != null && !services.equalsIgnoreCase("n/a")) {
45: sb.append(" (" + services + ")");
46: }
47: return sb.toString();
48: }
49:
50: }
|