MCPcopy
hub / github.com/oshi/oshi / printServices

Method printServices

oshi-core/src/test/java/oshi/SystemInfoTest.java:293–309  ·  view source on GitHub ↗
(OperatingSystem os)

Source from the content-addressed store, hash-verified

291 }
292
293 private static void printServices(OperatingSystem os) {
294 oshi.add("Services: ");
295 oshi.add(" PID State Name");
296 // DO 5 each of running and stopped
297 int i = 0;
298 for (OSService s : os.getServices()) {
299 if (s.getState().equals(OSService.State.RUNNING) && i++ < 5) {
300 oshi.add(String.format(" %5d %7s %s", s.getProcessID(), s.getState(), s.getName()));
301 }
302 }
303 i = 0;
304 for (OSService s : os.getServices()) {
305 if (s.getState().equals(OSService.State.STOPPED) && i++ < 5) {
306 oshi.add(String.format(" %5d %7s %s", s.getProcessID(), s.getState(), s.getName()));
307 }
308 }
309 }
310
311 private static void printSensors(Sensors sensors) {
312 oshi.add("Sensors: " + sensors.toString());

Callers 1

mainMethod · 0.95

Calls 4

getServicesMethod · 0.65
getStateMethod · 0.65
getProcessIDMethod · 0.65
getNameMethod · 0.65

Tested by

no test coverage detected