Code cloning is a common programming practice, and there have been a considerable amount of research that investigated the implications of code clones on software maintenance using static analysis. However, little has been done to inves- tigate the runtime implications of code cloning. In this paper we investigate source code clones at runtime, referring to clones as 'active clones' if they are invoked when a software system is in use. For example, if a particular use u of a system results in a clone c being invoked, we say that clone c is active with respect to use u. From this definition and given a set of usesfu1; u2;:::g and clonesfc1; c2;:::g we are able to identify the extent clones are active at runtime and analyze active clone resource use (e.g., CPU time) and define and calculate a set of active clone metrics to provide insights into source code cloning implications at runtime. We de- veloped a hybrid static and dynamic analysis technique for detecting and analysing active clones, and conducted an empirical study on five software systems (HSQLDB, JHotDraw, RText, jEdit and UniCentaoPOS) to validate our approach. We found a small portion of clones are active during a typical use of a software system, and that active clones have the potential for guiding a software developer's code inspection activity during a software maintenance task.
['Mohammad Asif A. Khan', 'Kevin A. Schneider', 'C. Roy']
Active Clones: Source Code Clones at Runtime