int tid        = previous_thread.getIndex(); int global_tid = (timerInterrupted ? previous_thread.getGlobalIndex() : -previous_thread.getGlobalIndex()); tracing(tid, global_tid, startOfWallTime, endOfWallTime, tmp_counters);
  public void updateHPMcounters(VM_Thread previous_thread, VM_Thread current_thread, 				boolean timerInterrupted)  {    //-#if RVM_WITH_HPM    VM_SysCall.call0(VM_BootRecord.the_boot_record.sysHPMstopMyThreadIP);    long endOfWallTime   = VM_Magic.getTimeBase();    long startOfWallTime = 0;    long wallTime        = 0;    n_threadSwitches++;    if (previous_thread.hpm_counters == null) {      VM.sysWriteln("***VM_HPM.pdateHPMcounters() Previous thread id ",		    previous_thread.getIndex(),"'s hpm_counters was null!***"); VM.shutdown(-1);    }    if (VM_HardwarePerformanceMonitors.hpm_trace &&	// tracing on?	previous_thread.startOfWallTime != -1) {	// not the first time!      startOfWallTime = previous_thread.startOfWallTime;      wallTime   = endOfWallTime - startOfWallTime;      if (wallTime < 0) {  // don't expect this to happen	VM.sysWrite("***VM_HPM.updateHPMcounters(",previous_thread.getIndex());	VM.sysWrite(") wall time overflowed: current ",endOfWallTime);	VM.sysWrite(" - start ",startOfWallTime);VM.sysWrite(" = delta ",wallTime);	VM.sysWriteln(" < 0!***"); wallTime = 0;    } }    tmp_counters.counters[0] = wallTime;	// need relative time for aggregate values    // read counters    for (int i=1; i<=n_counters; i++) {      long value = VM_SysCall.call_L_I(VM_BootRecord.the_boot_record.sysHPMgetCounterMyThreadIP,i);      tmp_counters.counters[i] = value;    }    if (VM_HardwarePerformanceMonitors.hpm_trace) {     // tracing on ?      if (active) { 			// only acccumulate what is recorded!	tmp_counters.accumulate(                 vp_counters, n_counters);	tmp_counters.accumulate(previous_thread.hpm_counters, n_counters);      }      int tid        = previous_thread.getIndex();      int global_tid = (timerInterrupted ? previous_thread.getGlobalIndex() : -previous_thread.getGlobalIndex());      tracing(tid, global_tid, startOfWallTime, endOfWallTime, tmp_counters);    } else {			 	// always accumulate      tmp_counters.accumulate(                 vp_counters, n_counters);      tmp_counters.accumulate(previous_thread.hpm_counters, n_counters);    }    if (VM_HardwarePerformanceMonitors.hpm_trace) { 	// tracing on ?      if (current_thread != null) {			// set up real time for current thread!	current_thread.startOfWallTime = VM_Magic.getTimeBase();      } else { 						// don't expect this to happen	if(VM_HardwarePerformanceMonitors.verbose>=3)	  VM.sysWriteln("***VM_HPM.updateHPMcounters() current_thread == null!***");    } }    VM_SysCall.call0(VM_BootRecord.the_boot_record.sysHPMresetMyThreadIP);    VM_SysCall.call0(VM_BootRecord.the_boot_record.sysHPMstartMyThreadIP);    //-#endif  }