hotspot/src/share/vm/runtime/fprofiler.cpp
changeset 25949 34557722059b
parent 25715 d5a8dbdc5150
child 26796 666464578742
equal deleted inserted replaced
25948:9b33776f4f07 25949:34557722059b
   627     _name = NULL;
   627     _name = NULL;
   628     update(where);
   628     update(where);
   629   }
   629   }
   630 
   630 
   631   vmNode(const char* name, const TickPosition where) : ProfilerNode() {
   631   vmNode(const char* name, const TickPosition where) : ProfilerNode() {
   632     _name = name;
   632     _name = os::strdup(name);
   633     update(where);
   633     update(where);
       
   634   }
       
   635 
       
   636   ~vmNode() {
       
   637     if (_name != NULL) {
       
   638       os::free((void*)_name);
       
   639     }
   634   }
   640   }
   635 
   641 
   636   const char *name()    const { return _name; }
   642   const char *name()    const { return _name; }
   637   bool is_compiled()    const { return true; }
   643   bool is_compiled()    const { return true; }
   638 
   644 
   782 void ThreadProfiler::vm_update(const char* name, TickPosition where) {
   788 void ThreadProfiler::vm_update(const char* name, TickPosition where) {
   783   int index = entry(vmNode::hash(name));
   789   int index = entry(vmNode::hash(name));
   784   assert(index >= 0, "Must be positive");
   790   assert(index >= 0, "Must be positive");
   785   // Note that we call strdup below since the symbol may be resource allocated
   791   // Note that we call strdup below since the symbol may be resource allocated
   786   if (!table[index]) {
   792   if (!table[index]) {
   787     table[index] = new (this) vmNode(os::strdup(name), where);
   793     table[index] = new (this) vmNode(name, where);
   788   } else {
   794   } else {
   789     ProfilerNode* prev = table[index];
   795     ProfilerNode* prev = table[index];
   790     for(ProfilerNode* node = prev; node; node = node->next()) {
   796     for(ProfilerNode* node = prev; node; node = node->next()) {
   791       if (((vmNode *)node)->vm_match(name)) {
   797       if (((vmNode *)node)->vm_match(name)) {
   792         node->update(where);
   798         node->update(where);
   793         return;
   799         return;
   794       }
   800       }
   795       prev = node;
   801       prev = node;
   796     }
   802     }
   797     prev->set_next(new (this) vmNode(os::strdup(name), where));
   803     prev->set_next(new (this) vmNode(name, where));
   798   }
   804   }
   799 }
   805 }
   800 
   806 
   801 
   807 
   802 class FlatProfilerTask : public PeriodicTask {
   808 class FlatProfilerTask : public PeriodicTask {