当前位置: 首页>>代码示例>>C++>>正文


C++ CCNode::incDeadBytes方法代码示例

本文整理汇总了C++中CCNode::incDeadBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::incDeadBytes方法的具体用法?C++ CCNode::incDeadBytes怎么用?C++ CCNode::incDeadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCNode的用法示例。


在下文中一共展示了CCNode::incDeadBytes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: read_trace_file

void read_trace_file(ifstream & in, CCNode * root)
{
  HeapObject * heapObject;
  HeapObject * targetObject;

  // CCNode * current_node = root;
  theStack[0] = root;
  threadStarts[0] = root;
  CCNode * node;
  int depth = 0;
  int time = 0;
  bool in_death_records = false;
  int last_epoch_time = 0;
  int last_thread_id = 0;

  while (in.good()) {
    char kind;
    string line;
    int object_id;
    int dtime;
    int size;
    string type;
    int method_id;
    string class_name;
    string method_name;
    string signature;
    int old_target;
    int new_target;
    int thread_id;

    Method * method;

    in >> kind;
    // in >> hex >> time;

    /*
    if (in_death_records && (kind != 'D')) {
      in_death_records = false;
      last_epoch_time = time;
    }
    */

    switch (kind) {
    case 'A':
      {
        in >> hex >> object_id;
        in >> hex >> size;
        in >> type;
        in >> hex >> thread_id;
        
        CCNode * curContext = 0;
        
        if (thread_id == object_id) {
          // -- Spawning a new thread -- make it a child of the root
          curContext = root; // theStack[last_thread_id];        
          CCNode * newContext = curContext->demand_child(method_id, thread_id, time);
          newContext->incCalls();
          theStack[thread_id] = newContext;
          if (debug > 0)
            cout << "Spawn thread 0x" << hex << thread_id << dec << endl;
        }
        
        curContext = theStack[thread_id];
        
        curContext->incAllocBytes(size);
        curContext->incAllocObjects();
        heapObject = HeapObject::DemandHeapObject(object_id);
        heapObject->setAlloc(time, size, type);
        heapObject->setAllocCC(curContext);
        
        if (debug > 0) {
          cout << "Allocate 0x" << hex << object_id << " size 0x" << size << dec << " at time " << time << endl;
          if (debug > 1) curContext->printStack();
	}	

	last_thread_id = thread_id;
      }
      objects.push_back(object_id);
      break;
    case 'D':
      {
        in >> hex >> object_id;
        
        heapObject = HeapObject::DemandHeapObject(object_id);
        heapObject->setDead(time);
        (HeapObject::Find(heapObject))->incNumDead();
        
        CCNode * curContext = theStack[last_thread_id];
        
        curContext->incDeadBytes(heapObject->getSize());
        curContext->incDeadObjects();
        heapObject->setDeathCC(curContext);
      }
      break;
    case 'U':
      in >> hex >> old_target;
      in >> hex >> object_id;
      in >> hex >> new_target;
      if (new_target != 0) {
	heapObject = HeapObject::DemandHeapObject(object_id);
//.........这里部分代码省略.........
开发者ID:RedlineResearch,项目名称:elephant-tracks,代码行数:101,代码来源:deathTracker.cpp


注:本文中的CCNode::incDeadBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。