if (debug>=3) System.out.println("TraceHeader() MACHINE_TYPE_RECORD "+processor_name);
if (debug>=3) System.out.println(trips+": TraceHeader() MACHINE_TYPE_RECORD "+processor_name);
  public TraceHeader(String header_filename, String trace_filename)   {    filename = trace_filename;    DataInputStream input_file = openTraceMetaFile(header_filename, trace_filename);    version    = Utilities.getIntFromDataInputStream(input_file);    n_counters = Utilities.getIntFromDataInputStream(input_file);    mode       = Utilities.getIntFromDataInputStream(input_file);        if(debug>=1) System.out.println(" version "+version+", n_counters "+n_counters+", mode "+mode);    int n_elements      = n_counters+1;    // allocate and initialize arrays    short_event_names   = new String[ n_elements];    ids                 = new int[    n_elements];    status              = new int[    n_elements];    thresholdable       = new boolean[n_elements];    for (int i=0; i<n_elements; i++) {      ids[                i] = 0;      short_event_names[  i] = null;      status[       i] = -1;      thresholdable[i] = false;    }    // read records from trace file    HashMap map     = new HashMap();    // Global TID (Integer) X thread name(String)    HashMap mapg2l  = new HashMap();    // Global TID (Integer) X TID (Integer)    while(true) {      int record_type = Utilities.getIntFromDataInputStream(input_file);      if (record_type == Utilities.EOF_int) {        break;      } else if (record_type == MACHINE_TYPE_FORMAT) {        processor_name = Utilities.getStringFromDataInputStream(input_file);        if (debug>=3) System.out.println("TraceHeader() MACHINE_TYPE_RECORD "+processor_name);      } else if (record_type == EVENT_FORMAT) {        int counter_number = Utilities.getIntFromDataInputStream(input_file);        if (counter_number >= n_elements) {          System.out.println("TraceHeader("+trace_filename+") counter number "+                             counter_number+" > n_elements "+n_elements);          System.exit(-1);        }        ids[counter_number] =  Utilities.getIntFromDataInputStream(input_file);        short_event_names[counter_number] = Utilities.getStringFromDataInputStream(input_file);        if (debug>=3) System.out.println("TraceHeader() EVENT_RECORD "+counter_number+" = "+                                         ids[counter_number]+" : "+short_event_names[counter_number]);      } else if (record_type == THREAD_FORMAT) {        int tid       = Utilities.getIntFromDataInputStream(input_file);        int local_tid = Utilities.getIntFromDataInputStream(input_file);        if (n_threads < tid) n_threads = tid;        String thread_name = Utilities.getStringFromDataInputStream(input_file);        Integer TID = new Integer(tid);        map.put(TID, thread_name);        if (debug>=3) System.out.println("TraceHeader() THREAD_RECORD global tid "+tid+" : "+                                         local_tid+" : "+thread_name);        Integer LOCAL_TID = new Integer(local_tid);        mapg2l.put(TID,LOCAL_TID);      } else if (record_type == METHOD_FORMAT) {        int    mid               = Utilities.getIntFromDataInputStream(input_file);        String  class_name       = Utilities.getStringFromDataInputStream(input_file);        String method_name       = Utilities.getStringFromDataInputStream(input_file);        String method_descriptor = Utilities.getStringFromDataInputStream(input_file);        String full_name = class_name+"."+method_name+method_descriptor;        if (debug>=3) System.out.println("TraceHeader() METHOD_RECORD mid "+mid+" : "+full_name);        MID_map.put(new Integer(mid), full_name);      }    }    // allocate thread array.    threads = new String[n_threads+1];    for (int i = 0; i<=n_threads; i++) {      threads[i] = null;    }    if (debug>=3)      System.out.println("\nDump global thread id to thread name map:");    Set keys = map.keySet();    for (Iterator i = keys.iterator(); i.hasNext();) {      Integer Key = (Integer)i.next();      String  thread_name = (String)map.get(Key);      int key = Key.intValue();      if (key >=0) {        threads[key] = thread_name;        if(debug>=3)System.out.println(" threads["+key+"] = "+thread_name);      } else {        if(debug>=3)System.out.println(" threads["+key+"] = "+thread_name+" discarded!" );      }    }    // allocate thread array.    globalToLocalTIDs = new int[n_threads+1];    if (debug>=3)      System.out.println("\nDump global to local thread id map:");    keys = mapg2l.keySet();    for (Iterator i = keys.iterator(); i.hasNext();) {      Integer Key = (Integer)i.next();      Integer Local_Tid = (Integer)mapg2l.get(Key);      int tid = Key.intValue();      if (tid >= 0) {        globalToLocalTIDs[tid] = Local_Tid.intValue();        if(debug>=3)System.out.println(" globalToLocalTIDs["+tid+"] = "+Local_Tid);      } else {        if(debug>=3)System.out.println(" globalToLocalTIDs["+tid+"] = "+Local_Tid+" discarded!");      }    }    if (debug>=2) print();  }