int index = 0;
Offset index = Offset.zero();
  static private void writeThread(int global_tid, int tid, String name)  {    if(verbose>=5) {      VM.sysWrite  ("VM_HPMs.writeThread(",global_tid,",",tid);      VM.sysWriteln(",",name,")");    }    int index = 0;    // do we need this?    //    name = wordAlignedString(name);    byte[] buffer = new byte[name.length()+4+12];    // write record format number    VM_Magic.setIntAtOffset(buffer, index, THREAD_RECORD);      index += SIZE_OF_INT;    // write global thread id    VM_Magic.setIntAtOffset(buffer, index, global_tid);         index += SIZE_OF_INT;    // write local thread id    VM_Magic.setIntAtOffset(buffer, index, tid);                index += SIZE_OF_INT;    // write event name    index = writeStringToBuffer(buffer, index, name.getBytes());    // write buffer to file    writeHeaderFileOutputStream(buffer, index);  }