Abstract:Path profiling, an important technique in dynamic program analysis, which collects the execution times of different paths, has been widely used in a variety of areas. However, existing intra-procedural profiling techniques have inadequate abilities in loops, i.e., they can only either solve profiling acyclic paths, or limit loop iterations to a certain number first, and then profile paths under such a limitation. This paper presents a new profiling technique called PAP (profiling all paths), which can profile finite-length paths inside a procedural. PAP consists of two basic phases: one is the probe instrumentation which assigns a unique pathid for each path, and the other is backwalk which uses the pathids to determine the corresponding executed paths. Furthermore, breakpoints are introduced to store the probe value which may overflow during long executions, and the probe amount is reduced base on the integration of PAP with an existing profiling technique. Besides, this paper also discusses how to use PAP to profile executed sequences on the method level. As shown in the results of the case study and experiments, PAP is effective and efficient in profiling cyclic paths.