如何衡量在一个功能上花费的总时间? [英] How to measure total time spent in a function?

查看:79
本文介绍了如何衡量在一个功能上花费的总时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实用程序功能,我怀疑它正在消耗应用程序执行时间的很大一部分.使用Time Profiler查看调用堆栈,此函数占用了从中调用任何函数的大部分执行时间.但是,由于该实用程序函数是从许多不同的来源调用的,因此我很难确定总体上这是否是优化时间的最佳利用方式.

I have a utility function that I suspect is eating up a large portion of my application's execution time. Using Time Profiler to look at the call stack, this function takes up a large portion of the execution time of any function from which it is called. However, since this utility function is called from many different sources, I am having trouble determining if, overall, this is the best use of my optimization time.

我如何查看程序执行期间在此函数上花费的总时间,而不管是谁调用的?

How can I look at total time spent in this function during program execution, regardless of who called it?

为清楚起见,我想将所选条目与对该函数的所有其他调用合并到一个条目中:

For clarity, I want to combine the selected entries with all other calls to that function into a single entry:

推荐答案

对我来说,诀窍是在反转调用树"上打勾.似乎在调用树中对叶"函数进行了排序,以使它们花费最多的时间,并允许您查看调用它们的方式.

For me, what does the trick is ticking "Invert Call Tree". It seems to sort "leaf" functions in the call tree in order of those that cumulate the most time, and allow you to see what calls them.

该复选框可在右侧面板中找到,称为显示设置"(如果隐藏:⌘2或View-> Inspectors-> Show Display Settings)

The checkbox can be found in the right panel, called "Display Settings" (If hidden: ⌘2 or View->Inspectors->Show Display Settings)

这篇关于如何衡量在一个功能上花费的总时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆