OPTIMALLY PROFILING AND TRACING PROGRAMS

被引:172
作者
BALL, T [1 ]
LARUS, JR [1 ]
机构
[1] UNIV WISCONSIN,DEPT COMP SCI,MADISON,WI 53706
来源
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS | 1994年 / 16卷 / 04期
关键词
ALGORITHMS; MEASUREMENT; CONTROL-FLOW GRAPH; INSTRUCTION TRACING; INSTRUMENTATION; PROFILING;
D O I
10.1145/183432.183527
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
This paper describes algorithms for inserting monitoring code to profile and trace programs. These algorithms greatly reduce the cost of measuring programs with respect to the commonly used technique of placing code in each basic block. Program profiling counts the number of times each basic block in a program executes. Instruction tracing records the sequence of basic blocks traversed in a program execution. The algorithms optimize the placement of counting/tracing code with respect to the expected or measured frequency of each block or edge in a program's control-flow graph. We have implemented the algorithms in a profiling/tracing tool, and they substantially reduce the overhead of profiling and tracing. We also define and study the hierarchy of profiling problems. These problems have two dimensions: what is profiled (i.e., vertices (basic blocks) or edges in a control-flow graph) and where the instrumentation code is placed (in blocks or along edges). We compare the optimal solutions to the profiling problems and describe a new profiling problem: basic-block profiling with edge counters. This problem is important because an optimal solution to any other profiling problem (for a given control-flow graph) is never better than an optimal solution to this problem. Unfortunately, finding an optimal placement of edge counters for vertex profiling appears to be a hard problem in general. However, our work shows that edge profiling with edge counters works well in practice because it is simple and efficient and finds optimal counter placements in most cases. Furthermore, it yields more information than a vertex profile. Tracing also benefits from placing instrumentation code along edges rather than on vertices.
引用
收藏
页码:1319 / 1360
页数:42
相关论文
共 32 条
[1]  
Aho A.V, 1986, COMPILERS PRINCIPLES
[2]  
[Anonymous], 1983, DATA STRUCTURES NETW, DOI DOI 10.1137/1.9781611970265
[3]  
BALL T, 1993, SIGPLAN NOTICES, V28, P300, DOI 10.1145/173262.155119
[4]   TECHNIQUES FOR DEBUGGING PARALLEL PROGRAMS WITH FLOWBACK ANALYSIS [J].
CHOI, JD ;
MILLER, BP ;
NETZER, RHB .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 1991, 13 (04) :491-530
[5]  
CMELIK RF, 1991, SIGARCH COMPUTER ARC, V19, P290
[6]  
FISHER JA, 1984, SIGPLAN NOTICES, V19, P37, DOI 10.1145/502949.502878
[7]  
Forman I. R., 1981, 5th International Conference on Software Engineering, P164
[8]  
Garey M.R., 1979, COMPUTERS INTRACTABI, V174
[9]  
GOLDBERG A, 1991, CSLTR91495 STANF U C
[10]   MTOOL - AN INTEGRATED SYSTEM FOR PERFORMANCE DEBUGGING SHARED MEMORY MULTIPROCESSOR APPLICATIONS [J].
GOLDBERG, AJ ;
HENNESSY, JL .
IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, 1993, 4 (01) :28-40