博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
chromium之tracked
阅读量:4968 次
发布时间:2019-06-12

本文共 1829 字,大约阅读时间需要 6 分钟。

//------------------------------------------------------------------------------// Tracked is the base class for all tracked objects.  During construction, it// registers the fact that an instance was created, and at destruction time, it// records that event.  The instance may be tagged with a name, which is refered// to as its Location.  The Location is a file and line number, most// typically indicated where the object was constructed.  In some cases, as the// object's significance is refined (for example, a Task object is augmented to// do additonal things), its Location may be redefined to that later location.// Tracking includes (for each instance) recording the birth thread, death// thread, and duration of life (from construction to destruction).  All this// data is accumulated and filtered for review at about:objects.

信息跟踪收集,用于统计分析的工具


下面的代码是不是很熟悉,FROM_HERE

message_loop->PostTask(FROM_HERE,...)#define FROM_HERE tracked_objects::Location(__FUNCTION__, __FILE__, __LINE__)

 

构造函数如下:

class Location { public:  // Constructor should be called with a long-lived char*, such as __FILE__.  // It assumes the provided value will persist as a global constant, and it  // will not make a copy of it.  Location(const char* function_name, const char* file_name, int line_number)      : function_name_(function_name),        file_name_(file_name),        line_number_(line_number) { }}

记录了函数名,文件名,行号

 

不过,只有在调试模式,才会有比较详细的统计信息

#ifndef NDEBUG#ifndef TRACK_ALL_TASK_OBJECTS#define TRACK_ALL_TASK_OBJECTS#endif   // TRACK_ALL_TASK_OBJECTS#endif  // NDEBUG

 

调试模式下,多了一个没见过的ThreadData,可以分析分析

Tracked::Tracked() : tracked_births_(NULL), tracked_birth_time_(Time::Now()) {  if (!ThreadData::IsActive())    return;  SetBirthPlace(Location("NoFunctionName", "NeedToSetBirthPlace", -1));}

 

转载于:https://www.cnblogs.com/ckelsel/p/9053534.html

你可能感兴趣的文章
点群的判别(三)
查看>>
GNSS 使用DFT算法 能量损耗仿真
查看>>
【转】Simulink模型架构指导
查看>>
MYSQL数据库的导出的几种方法
查看>>
SQL Server-5种常见的约束
查看>>
硬件之美
查看>>
[转载]java开发中的23种设计模式
查看>>
表格的拖拽功能
查看>>
函数的形参和实参
查看>>
【TP SRM 703 div2 500】 GCDGraph
查看>>
MapReduce 重要组件——Recordreader组件 [转]
查看>>
webdriver api
查看>>
apache 实现图标缓存客户端
查看>>
揭秘:黑客必备的Kali Linux是什么,有哪些弊端?
查看>>
linux系统的远程控制方法——学神IT教育
查看>>
springboot+mybatis报错Invalid bound statement (not found)
查看>>
Linux环境下SolrCloud集群环境搭建关键步骤
查看>>
P3565 [POI2014]HOT-Hotels
查看>>
MongoDB的简单使用
查看>>
hdfs 命令使用
查看>>