00001 // =================================================================== 00002 // basic-merge-main.cc 00003 // Scott F. H. Kaplan -- sfkaplan@cs.amherst.edu 00004 // October 2002 00005 00006 // Merge reference and kernel traces created by the Bochs Tracer (BT) 00007 // and the BT-kernel run within the BT. This utility produces 00008 // straight reference traces, with a tag for read/write, and a page 00009 // number. The page numbers produced are *logical* page numbers, thus 00010 // revealing the referencing of shared pages to a page replacement 00011 // simulator. 00012 00013 // Note that this module is just the bootstrapping code for the 00014 // process. It creates a Basic_Consumer object and calls merge(), 00015 // which does all of the actual work. 00016 // =================================================================== 00017 00018 00019 00020 // =================================================================== 00021 #include "Basic_Consumer.hh" 00022 // =================================================================== 00023 00024 00025 00026 // =================================================================== 00027 int 00028 main (const unsigned int argc, const char** const argv) { 00029 00030 // Were the correct number of arguments passed? 00031 if (argc != 3) { 00032 00033 // No. Emit usage and exit. 00034 fprintf(stderr, "Usage: %s\n", argv[0]); 00035 fprintf(stderr, " <reference trace pathname>\n"); 00036 fprintf(stderr, " <kernel trace pathname>\n"); 00037 return 1; 00038 00039 } 00040 00041 // Create the trace consumer object. 00042 Basic_Consumer* consumer = new Basic_Consumer(argv[1], argv[2]); 00043 if (consumer == 0) { 00044 fprintf(stderr, "main(): Failed allocation of Basic_Consumer\n"); 00045 return 1; 00046 } 00047 00048 // Merge the traces. 00049 consumer->merge(); 00050 00051 // Eliminate the consumer object. 00052 delete consumer; 00053 consumer = 0; 00054 00055 // Exit successfully. 00056 return 0; 00057 00058 } // main 00059 // ===================================================================