ApplicationMerge.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.data.framework;
00002 
00003 import java.io.File;
00004 
00005 import edu.rice.cs.hpc.data.experiment.Experiment;
00006 import edu.rice.cs.hpc.data.experiment.merge.ExperimentMerger;
00007 
00008 public class ApplicationMerge {
00009 
00010     /***---------------------------------------------------------------------**
00011      * Open a XML database file, and return true if everything is OK.
00012      * @param objFile: the XML experiment file
00013      * @return
00014      ***---------------------------------------------------------------------**/
00015     private static Experiment openExperiment(File objFile) {
00016         Experiment experiment;
00017 
00018         try {
00019             experiment = new Experiment();  // prepare the experiment
00020             experiment.open(objFile, null, false);                      // parse the database
00021 
00022             return experiment;
00023         } catch (Exception e) {
00024             e.printStackTrace();
00025             return null;
00026         }
00027     }
00028     
00029 
00033     public static void main(String[] args) {
00034         
00035         if (args.length != 2) {
00036             showHelp();
00037             return;
00038         }
00039         File f1 = new File(args[0]);
00040         Experiment exp1 = openExperiment(f1);
00041         if (exp1 == null) {
00042             System.err.println("Cannot open database: " + args[0]);
00043             return;
00044         }
00045         
00046         File f2 = new File(args[1]);
00047         Experiment exp2 = openExperiment(f2);
00048         if (exp2 == null) {
00049             System.err.println("Cannot open database: " + args[1]);
00050         }
00051     
00052         Experiment merge = ExperimentMerger.merge(exp1, exp2, ExperimentMerger.MergeType.TOP_DOWN, true);
00053         if (merge == null) {
00054             System.err.println("Fail to merge");
00055         }
00056     }
00057 
00058     private static void showHelp() 
00059     {
00060         System.out.println("Syntax: ApplicationMerge file_db1 file_db2");
00061     }
00062 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1