forked from opf-labs/c3po
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DirectProfileCommand.java
57 lines (43 loc) · 1.28 KB
/
DirectProfileCommand.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.petpet.c3po.command;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.petpet.c3po.parameters.DirectProfileParams;
import com.petpet.c3po.parameters.Params;
import com.ifs.directprofiler.core.Controller;
public class DirectProfileCommand implements Command {
private static final Logger LOG = LoggerFactory
.getLogger(DirectProfileCommand.class);
private DirectProfileParams params;
private long time = -1L;
@Override
public void setParams(Params params) {
if (params != null && params instanceof DirectProfileParams) {
this.params = (DirectProfileParams) params;
}
}
@Override
public void execute() {
LOG.info("Starting direct profiling command.");
long start = System.currentTimeMillis();
Controller ctrl = new Controller();
try {
ctrl.Execute(this.params.getInputLocation(),
this.params.getOutnputLocation());
System.out.println("I finished profiling all the data.");
} catch (IOException e) {
LOG.error(e.getMessage());
System.err.println("An error occurred: " + e.getMessage());
return;
}
long end = System.currentTimeMillis();
this.setTime(end - start);
}
@Override
public long getTime() {
return this.time;
}
protected void setTime(long time) {
this.time = time;
}
}