00001 // =================================================================== 00002 // per-process-merge-main.cc 00003 // Scott F. H. Kaplan -- sfkaplan@cs.amherst.edu 00004 // November 2002 00005 00006 // Merge the raw reference trace and kernel traces created by Laplace. 00007 // This utility will create one basic reference trace for each process 00008 // represented in the raw reference trace. A ``process'' is one or 00009 // more threads (Linux ``tasks'') that share a virtual address space 00010 // at one or more overlapping moments of execution. (That is, two 00011 // tasks that use a particular virtual address space at disjoint times 00012 // are not considered threads of the same process.) 00013 00014 // Note that this module is just the bootstrapping code for the 00015 // process. It creates a Per_Process_Consumer object and calls 00016 // merge(), which does all of the actual work. 00017 // =================================================================== 00018 00019 00020 00021 // =================================================================== 00022 #include "Per_Process_Consumer.hh" 00023 // =================================================================== 00024 00025 00026 00027 // =================================================================== 00028 int 00029 main (const unsigned int argc, const char** const argv) { 00030 00031 // Were the correct number of arguments passed? 00032 if (argc != 3) { 00033 00034 // No. Emit usage and exit. 00035 fprintf(stderr, "Usage: %s\n", argv[0]); 00036 fprintf(stderr, " <reference trace pathname>\n"); 00037 fprintf(stderr, " <kernel trace pathname>\n"); 00038 return 1; 00039 00040 } 00041 00042 // Create the trace consumer object. 00043 Per_Process_Consumer* consumer = 00044 new Per_Process_Consumer(argv[1], argv[2]); 00045 if (consumer == 0) { 00046 fprintf(stderr, 00047 "main(): Failed allocation of Per_Process_Consumer\n"); 00048 return 1; 00049 } 00050 00051 // Merge the traces. 00052 consumer->merge(); 00053 00054 // Eliminate the consumer object. 00055 delete consumer; 00056 consumer = 0; 00057 00058 // Exit successfully. 00059 return 0; 00060 00061 } // main 00062 // ===================================================================