将光标移到/点击文章中的句子上,可以查看译文。      显示繁体中文内容    显示简体中文内容

How to measure?
如何测量?

0 0

when i did performance-tuning, i will first to work in the high-level and try to answer is this cpu-bound or IO-bound?

when i make sure this is the cpu-bound, then i will try to find hotspot by adding some timer code.This is good, but i failed to figure out these issues :

  1. cache misses
  2. thread context effect.

Is there any one knows how to measure these items?

时间: 原作者:

0 0

Are you open to a different way of thinking about performance tuning?
It does not look at I/O vs CPU bound, hotspots, and timers.

First, think about just one thread.the execution of a thread is much like a tree.there is a main function (the trunk).there are points when subroutines are called (branches).there are terminal instructions (leaves) and blocking calls like I/O (fruit).the total time the program takes is the sum of all the leaves and all the fruit.

What you want to do is prune the tree, making it as light as possible, without killing it.

What many people do is weigh (time) the whole thing, and then weigh parts of it, and so on, and hope to find hotspots (leafy branches) that maybe they could trim.

Another way is 1 ) select some leaves or fruit at random.2 ) from each leaf or fruit, paint a line from it along the branch it is on, all the way back to the trunk.3 ) take note of branches that have> 1 lines painted on them.4 ) ask"Do i need this branch?".if you can prune it, do so.you will eliminate the entire weight of the branch, and you did it without weighing it.then start over.

That's the idea behind random-pausing.there are certain kinds of problems it will not find, but most of them it will find, quickly, including any that timing threads can find.

原作者:
0 0

1) use cachegrind/callgrind/kcachegrind http://valgrind.org/info/tools.html#cachegrind

pretty useful in terms of analysing memory locality under specific sets of assumptions.

2) Threading is really painful to profile correctly.Play some with cpusets and process affinities, on modern NUMA systems it becomes critical quickly.

原作者:
...