Databases Reference
In-Depth Information
cannot completely capture some useful orderings shared by APIs, especially
when multiple APIs are involved across different procedures.
To address the issues faced by previous approaches in mining API patterns,
we develop a framework to automatically mine frequent partial orders among
user-specified APIs, directly from the source code (API client code). Frequent
partial orders summarize important ordering information from sequential pat-
terns. Frequent partial orders provide more general and more concise API
ordering information than the sequential patterns. The mined partial orders
among APIs can assist the correct and effective API reuse by the program-
mers. This section describes the following main steps required for generating
static traces from source code and mining API specifications and usage sce-
narios from the generated static traces.
Static API Trace Generation: We adapt a model checker to generate
inter-procedural control-flow-sensitive static traces related to the APIs of in-
terest. Our framework allows mining of open-source systems that reuse the
APIs of interest without requiring environment setup for system executions
or availability of sucient system tests.
Scenario Extraction: A single static trace from the model checker might
involve several API scenarios, being often interspersed. We present an algo-
rithm, which considers the data flow between program statements in terms
of shared variables, to separate different scenarios from a given trace, so that
each scenario can be fed separately to the miner.
API Partial-Order Mining: We present novel applications of a miner in
mining partial orders among APIs from static traces. The mined partial orders
provide important, useful API ordering information that is not provided by
patterns mined by previous approaches.
We describe an implementation of our framework by adapting a pub-
licly available model checker called MOPS [20] and adopting a miner called
FRECPO [47]. We apply our framework on 72 clients of X11 with 208 KLOC
in total and compare our framework with an existing dynamic specification
miner. Our results highlight the unique benefits of our framework and show
that the extracted API partial orders are useful in assisting effective API reuse
and checking.
The remainder of this section is structured as follows. Section 5.2.1 starts
with an example that motivates our framework. Section 5.2.2 introduces the
formal framework for mining API partial orders and describes the various com-
ponents in our framework in detail. Section 5.2.3 presents the implementation
details. Section 5.2.4 reports our experience of comparing our framework with
an existing dynamic specification miner.
5.2.1 Example
This section illustrates a partial order that our framework extracts for a
given set of related APIs, directly from the source code. Figure 5.1(a) shows a
simple code snippet in C that uses APIs from a header file <abcdef.h> , namely,
 
Search WWH ::




Custom Search