Reputation: 2604
I know how to run an external program in java:
public class Test {
public static void main(String[] args) throws Exception {
Process p = Runtime.getRuntime().exec(
"\"c:/my-simple-app.exe\"");
p.waitFor();
}
}
But how can I get all of the program properties when I run it like this? I mean: system time for this process (how much system time it took to run), cpu usage (only for this exact process), ... Is it possible?
Upvotes: 0
Views: 322
Reputation: 136002
Run this program in a separate thread, then run tasklist /v
process (if Windows), intercept output, split lines into columns, find my-simple-app.exe
and get necessary info. If tasklist info is not enough, then read process ID column form tasklist output and run some other util to get more info.
Upvotes: 2