Light-Weight Instrumentation From Relational Queries Over Program Traces

Simon Goldsmith, Robert O'Callahan and Alex Aiken

EECS Department
University of California, Berkeley
Technical Report No. UCB/CSD-04-1315
March 2004

http://www2.eecs.berkeley.edu/Pubs/TechRpts/2004/CSD-04-1315.pdf

Instrumenting programs with code to monitor their dynamic behaviour is a technique as old as computing. Today, most instrumentation is either inserted manually by programmers, which is tedious, or automatically by specialized tools, which are nontrivial to build and monitor particular properties. We introduce Program Trace Query Language (PTQL), a general language in which programmers can write expressive, declarative queries about program behaviour. PTQL is based on relational queries over program traces. We argue that PTQL is more amenable to human and machine understanding than competing languages. We also describe a compiler, Partiqle, that takes a PTQL query and a Java program and produces an instrumented program. This instrumented program runs normally but also evaluates the PTQL query on-line. We explain some novel optimizations required to compile relational queries into efficient instrumentation. To help evaluate our work, we present the results of applying a variety of PTQL queries to a set of benchmark programs, including the Apache Tomcat Web server. The results show that our prototype system already has usable performance, and that our optimizations are critical to obtaining this performance. Our queries also revealed significant (and apparently unknown) performance bugs in the jack SpecJVM98 benchmark, in Tomcat, and in the IBM Java class library, and some uncomfortably clever code in the Xerces XML parser.


BibTeX citation:

@techreport{Goldsmith:CSD-04-1315,
    Author = {Goldsmith, Simon and O'Callahan, Robert and Aiken, Alex},
    Title = {Light-Weight Instrumentation From Relational Queries Over Program Traces},
    Institution = {EECS Department, University of California, Berkeley},
    Year = {2004},
    Month = {Mar},
    URL = {http://www2.eecs.berkeley.edu/Pubs/TechRpts/2004/5590.html},
    Number = {UCB/CSD-04-1315},
    Abstract = {Instrumenting programs with code to monitor their dynamic behaviour is a technique as old as computing. Today, most instrumentation is either inserted manually by programmers, which is tedious, or automatically by specialized tools, which are nontrivial to build and monitor particular properties. We introduce Program Trace Query Language (PTQL), a general language in which programmers can write expressive, declarative queries about program behaviour. PTQL is based on relational queries over program traces. We argue that PTQL is more amenable to human and machine understanding than competing languages. We also describe a compiler, Partiqle, that takes a PTQL query and a Java program and produces an instrumented program. This instrumented program runs normally but also evaluates the PTQL query on-line. We explain some novel optimizations required to compile relational queries into efficient instrumentation. To help evaluate our work, we present the results of applying a variety of PTQL queries to a set of benchmark programs, including the Apache Tomcat Web server. The results show that our prototype system already has usable performance, and that our optimizations are critical to obtaining this performance. Our queries also revealed significant (and apparently unknown) performance bugs in the jack SpecJVM98 benchmark, in Tomcat, and in the IBM Java class library, and some uncomfortably clever code in the Xerces XML parser.}
}

EndNote citation:

%0 Report
%A Goldsmith, Simon
%A O'Callahan, Robert
%A Aiken, Alex
%T Light-Weight Instrumentation From Relational Queries Over Program Traces
%I EECS Department, University of California, Berkeley
%D 2004
%@ UCB/CSD-04-1315
%U http://www2.eecs.berkeley.edu/Pubs/TechRpts/2004/5590.html
%F Goldsmith:CSD-04-1315