【问题标题】:time profiler on iOS device -- mark specific moments?iOS 设备上的时间分析器——标记特定时刻?
【发布时间】:2012-04-05 02:26:26
【问题描述】:

基本上,每当调用方法 foo 时,我希望在我的跟踪中出现一条垂直线(或标志)。这可能吗?

(请注意,DTPerformanceSession 似乎不支持 iOS 设备。)

【问题讨论】:

    标签: iphone ios performance profiling instruments


    【解决方案1】:

    我知道这是个老问题,但DTPerformanceSession 框架包含一个标头DTSignalFlag.h,它为DTSendSignalFlag 函数提供接口。它仅支持模拟器,并且在针对 iOS 7 时似乎不起作用,但在早期版本的 iOS 中非常有用(即使是 Xcode 5)。

    您需要包含标题:

    #import <DTPerformanceSession/DTSignalFlag.h>
    

    但是,要访问标头,您必须将 DTPerformanceSession 框架添加到您的项目中,但是您可以将其删除以避免链接器错误(但您仍然可以访问标头),然后您可以执行以下操作:

    // Point flag (just an event in time)
    DTSendSignalFlag("com.mycompany.mytracepoints.app.point", DT_POINT_SIGNAL, TRUE);
    
    // Start flag (to mark the start of something)
    DTSendSignalFlag("com.mycompany.mytracepoints.app.start", DT_START_SIGNAL, TRUE);
    
    // End flag (to mark the end of something)
    DTSendSignalFlag("com.mycompany.mytracepoints.app.end", DT_END_SIGNAL, TRUE);
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多