com.seleniumtests.util.osutility.ProcessInfo Maven / Gradle / Ivy
/**
* Orignal work: Copyright 2015 www.seleniumtests.com
* Modified work: Copyright 2016 www.infotel.com
* Copyright 2017-2019 B.Hecquet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.seleniumtests.util.osutility;
public class ProcessInfo {
private String pid;
private String name;
private String sessionName; //Console, Services
private int sessionNumber;
private int memUsage; // Ko
private String status; // Running, Unknown, Not Responding
private String username;
private String cpuTime; // HH:mm:ss
private String title; // N/A, MINGW64:/d/workspace, ...
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSessionName() {
return sessionName;
}
public void setSessionName(String sessionName) {
this.sessionName = sessionName;
}
public int getSessionNumber() {
return sessionNumber;
}
public void setSessionNumber(int sessionNumber) {
this.sessionNumber = sessionNumber;
}
public int getMemUsage() {
return memUsage;
}
public void setMemUsage(int memUsage) {
this.memUsage = memUsage;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getCpuTime() {
return cpuTime;
}
public void setCpuTime(String cpuTime) {
this.cpuTime = cpuTime;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Process #" + pid + " = " + name);
if (getMemUsage() != 0){
sb.append(" ; session=" + sessionName + ", #" + sessionNumber
+ " ; " + memUsage + " Ko"
+ " ; status=" + status
+ " ; username=" + username
+ " ; " + cpuTime
+ " ; title=\"" + title + "\"");
}
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
ProcessInfo info = (ProcessInfo) obj;
return this.toString().equals(info.toString());
}
@Override
public int hashCode() {
return this.toString().hashCode();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy