-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for RoadRunner and STD formats
- Loading branch information
Showing
23 changed files
with
1,992 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package print.cmd; | ||
|
||
import print.parse.ParserType; | ||
|
||
public class CmdOptions { | ||
public String path; | ||
public ParserType parserType; | ||
public String map_file; | ||
|
||
public CmdOptions() { | ||
this.path = null; | ||
this.map_file = null; | ||
this.parserType = ParserType.RR; | ||
} | ||
|
||
public String toString(){ | ||
String str = ""; | ||
str += "path " + " = " + this.path + "\n"; | ||
str += "path to map file" + " = " + this.map_file + "\n"; | ||
str += "parserType " + " = " + this.parserType.toString() + "\n"; | ||
return str; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package print.cmd; | ||
|
||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import org.apache.commons.cli.DefaultParser; | ||
import org.apache.commons.cli.CommandLine; | ||
import org.apache.commons.cli.CommandLineParser; | ||
import org.apache.commons.cli.HelpFormatter; | ||
import org.apache.commons.cli.Options; | ||
import org.apache.commons.cli.ParseException; | ||
|
||
import print.parse.ParserType; | ||
|
||
public class GetOptions { | ||
|
||
private static final Logger log = Logger.getLogger(GetOptions.class.getName()); | ||
private String[] args = null; | ||
private Options options = new Options(); | ||
|
||
public GetOptions(String[] args) { | ||
this.args = args; | ||
options.addOption("h", "help", false, "generate this message"); | ||
options.addOption("f", "format", true, "format of the trace. Possible choices include rv, rr, std (Default : rr) "); | ||
options.addOption("p", "path", true, "the path to the trace file/folder (Required)"); | ||
options.addOption("m", "map", true, "file path to dump the map file [mapping event ids to their descriptions] (Required)"); | ||
|
||
} | ||
|
||
public CmdOptions parse() { | ||
CommandLineParser parser = new DefaultParser(); | ||
CommandLine cmd = null; | ||
CmdOptions cmdOpt = new CmdOptions();; | ||
|
||
try { | ||
cmd = parser.parse(options, args); | ||
if (cmd.hasOption("h")) | ||
help(); | ||
|
||
if (cmd.hasOption("f")) { | ||
cmdOpt.parserType = ParserType.getType(cmd.getOptionValue("f")) ; | ||
if (cmdOpt.parserType.isRV()) { | ||
System.err.println("**Warning** - Provided file format is RV. RVPredict support is getting obsolete day-by-day. \nConsider using some other logger.\n"); | ||
} | ||
} | ||
|
||
if (cmd.hasOption("p")) { | ||
cmdOpt.path = cmd.getOptionValue("p") ; | ||
} | ||
else { | ||
log.log(Level.INFO, "MIssing path to trace file/folder"); | ||
help(); | ||
} | ||
|
||
if (cmd.hasOption("m")) { | ||
cmdOpt.map_file = cmd.getOptionValue("m") ; | ||
} | ||
else { | ||
log.log(Level.INFO, "MIssing path to map file"); | ||
help(); | ||
} | ||
|
||
} catch (ParseException e) { | ||
help(); | ||
} | ||
|
||
return cmdOpt; | ||
} | ||
|
||
private void help() { | ||
HelpFormatter formater = new HelpFormatter(); | ||
formater.printHelp("Ziptrack-Print", options); | ||
System.exit(0); | ||
} | ||
|
||
public static void main(String[] args) { | ||
new GetOptions(args).parse(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package print.engine; | ||
|
||
import print.parse.rr.ParseRoadRunner; | ||
import print.parse.rv.parserv.ParseRVPredict; | ||
import print.parse.std.ParseStandard; | ||
import print.parse.ParserType; | ||
import print.event.Event; | ||
|
||
public abstract class Engine<E extends Event> { | ||
protected ParserType parserType; | ||
protected ParseRVPredict rvParser;//RV | ||
protected ParseStandard stdParser; //STD | ||
protected ParseRoadRunner rrParser; //RR | ||
protected E handlerEvent; | ||
|
||
public Engine(ParserType pType){ | ||
this.parserType = pType; | ||
} | ||
|
||
protected void initializeReader(String trace_folder) { | ||
if(this.parserType.isRV()){ | ||
initializeReaderRV(trace_folder); | ||
} | ||
else if(this.parserType.isSTD()){ | ||
initializeReaderSTD(trace_folder); | ||
} | ||
else if(this.parserType.isRR()){ | ||
initializeReaderRR(trace_folder); | ||
} | ||
} | ||
|
||
protected void initializeReaderRV(String trace_folder){ | ||
rvParser = new ParseRVPredict(trace_folder, null); | ||
} | ||
|
||
protected void initializeReaderSTD(String trace_file) { | ||
stdParser = new ParseStandard(trace_file); | ||
} | ||
|
||
protected void initializeReaderRR(String trace_file) { | ||
rrParser = new ParseRoadRunner(trace_file); | ||
} | ||
} |
Oops, something went wrong.