Databases Reference
In-Depth Information
This chapter is based on a previously presented paper [29]. Besides pro-
viding additional material and experimental results, we here describe several
enhancements of our approach: A dataflow analysis helps to focus on related
method calls. Moreover, the analysis now produces FSMs with transitions
labeled with method calls, instead of labeling states and having anonymous
transitions. Therefore, the language accepted by the FSMs directly reflects
the call sequences that a protocol permits. Finally, all inferred protocols are
written to a specification database that accumulates results from analyzing
different programs over time.
The remainder of this text is organized as follows. Section 4.2 describes the
components of our analysis and shows how they work together. Sections 4.3
and 4.4 report on an implementation of the analysis and our experimental
results. A discussion of our approach and possible applications of it follows in
Section 4.5. Finally, we discuss related work and conclude.
4.2 Mining API Usage Protocols
This section describes a dynamic analysis to infer API usage protocols.
The analysis requires a program using an API and some input to run the pro-
gram. The output of the analysis are FSMs that describe typical API method
call sequences. The general idea is to learn common usage patterns from ex-
isting programs by analyzing in which order these programs call methods.
The underlying assumption is that frequently observed behavior is likely to
be correct [6].
Figure 4.2 provides an overview of the analysis. At first, we instrument
a program that uses a particular API so that it emits information about
method calls during execution. Running the instrumented program yields
method traces, that is, a sequences of method call and method return events.
An analysis of the traces identifies small sets of related API objects and the
methods that are called on them, which we call object collaborations. To
focus on call sequences that are relevant for inferring API usage protocols,
different collaboration transformers refine collaborations and filter irrelevant
parts of them. Afterward, the analysis summarizes collaborations into recur-
ring patterns, which finally are translated into FSMs that describe API usage
protocols.
The remainder of this section details the components of our analysis and
explains how they work together to mine API usage protocols.
 
Search WWH ::




Custom Search