|Publication number||US7861230 B2|
|Application number||US 11/420,056|
|Publication date||Dec 28, 2010|
|Filing date||May 24, 2006|
|Priority date||May 24, 2006|
|Also published as||US20070288940|
|Publication number||11420056, 420056, US 7861230 B2, US 7861230B2, US-B2-7861230, US7861230 B2, US7861230B2|
|Inventors||Jonathan W. Keljo|
|Original Assignee||Microsoft Corporation|
|Export Citation||BiBTeX, EndNote, RefMan|
|Patent Citations (5), Non-Patent Citations (4), Referenced by (2), Classifications (14), Legal Events (5)|
|External Links: USPTO, USPTO Assignment, Espacenet|
Software developers often wish to add some piece of functionality to their software without modifying the core parts of the code itself. There are various reasons for this. For example, it may not be prudent to change the code due to schedule pressures or fragility concerns. Also, the functionality may not be core to the software, and thus makes more sense to be structured as an add-on. Furthermore, the functionality itself may only be needed for a very limited period of time, such as while diagnosing a particular problem.
Profilers targeting runtime environments try keep their overhead as low as possible. The developers of profilers may insert diagnostic code, such as assertions or logging statements in debug builds. However, they do not want to pay even the small speed cost of checking whether such functionality is desired or the larger size cost of keeping the dormant code around. Therefore, developers of profilers will typically remove the diagnostic code from retail builds. There is no easy way to insert functionality for debugging and other purposes without modifying the code itself.
The following presents a simplified summary of the disclosure in order to provide a basic understanding to the reader. This summary is not an extensive overview of the disclosure and it does not identify key/critical elements of the invention or delineate the scope of the invention. Its sole purpose is to present some concepts disclosed herein in a simplified form as a prelude to the more detailed description that is presented later.
Described herein are various technologies and techniques directed to methods and systems for profiling API shims. In accordance with one implementation of the described technologies, a profiling shim is inserted between a profiler and a profiling application program interface (API) in a managed execution environment. The profiling shim intercepts communications between the profiler and the profiling API. Calls from and to the profiler are chained through the profiling shim. By using the profiling shim, additional functionality may be added without changing the code of the profiler. For example, the profiling shim may log calls to callback functions and information functions from and to the profiler. This logged information may be used to measure profiler overhead, get a context for incorrect profiler behavior, gain insight into how the profiler uses the profiling API, as well as for other purposes.
In another implementation of the described technologies, the profiling shim may validate the profiler's usage of the profiling API. The profiling shim may change the behavior of the profiling API functions to flush out bugs in the profiler, detect improper call sequences, detect the use of incorrect parameters, and/or perform other validation.
Many of the attendant features will be more readily appreciated as the same becomes better understood by reference to the following detailed description considered in connection with the accompanying drawings.
The present description will be better understood from the following detailed description read in light of the accompanying drawings, wherein:
Like reference numerals are used to designate like parts in the accompanying drawings.
The detailed description provided below in connection with the appended drawings is intended as a description of the present examples and is not intended to represent the only forms in which the present example may be constructed or utilized. The description sets forth the functions of the example and the sequence of steps for constructing and operating the example. However, the same or equivalent functions and sequences may be accomplished by different examples.
Client device 105 may represent at least one of a variety of known computing devices, including a desktop personal computer (PC), workstation, mainframe computer, Internet appliance, set-top box, or gaming console, that is able to implement example technologies. Client device 105 may further represent at least one device that is capable of being associated with network 125 by a wired and/or wireless link, including a mobile (i.e., cellular) telephone, personal digital assistant (PDA), laptop computer, etc. Further still, client device 105 may represent the client devices described above in various quantities and/or combinations thereof. “Other” device 115 may also be embodied by any of the above examples of client device 105.
Server device 110 may represent any device that is capable of providing any of a variety of data and/or functionality to client device 105 or “other” device 115 in accordance with at least one implementation for a profiling shim 120. The data may be publicly available or alternatively restricted, e.g., restricted to only certain users or only if an appropriate subscription or licensing fee is paid. Server device 110 may be at least one of a network server, an application server, a blade server, or any combination thereof. Typically, server device 110 may represent any device that may be a content source, and client device 105 may represent any device that may receive such content either via network 125 or in an off-line manner. However, according to the example implementations described herein, client device 105 and server device 110 may interchangeably be a sending node or a receiving node in network environment 100. “Other” device 115 may also be embodied by any of the above examples of server device 110. “Other” device 115 may represent any further device that is capable of implementing a profiling shim 120 according to one or more of the example technologies described herein. These examples are not intended to be limiting in any way, and therefore should not be construed in that manner.
Network 125 may represent any of a variety of conventional network topologies and types, which may include wired and/or wireless networks. Network 125 may further utilize any of a variety of conventional network protocols, including public and/or proprietary protocols. Network 125 may include, for example, the Internet as well at least portions of one or more local area networks (LANs), such as an 802.11 system or, on a larger scale, a wide area network (WAN), or a personal area network (PAN), such as Bluetooth.
Computer architecture in at least one of devices 105, 110, and 115 has typically defined computing platforms in terms of hardware and software. Software for computing devices has been categorized into groups, based on function, which may include: a hardware abstraction layer (alternatively referred to as a “HAL”), an operating system (alternatively referred to as “OS”), and applications.
A runtime execution environment may reside between an OS and an application, program, function, or other assemblage of code. The runtime execution environment may serve as a space in which the application, program, function, or other assemblage of code may execute specific tasks on any one or more of processing devices 105, 110, and 115. More particularly, a runtime execution environment may enhance the reliability of the execution of an application, program, function, or other assemblage of code on a growing range of processing devices 105, 110, and 105, including servers, desktop computers, laptop computers, and mobile processing/communication devices by providing a layer of abstraction and services for an application running on such devices, and by further providing the application, program, function, or other assemblage of code with capabilities including memory management and configuration thereof.
A runtime execution environment may serve as at least one of a programming and an execution platform. As a programming platform, a runtime execution environment may compile one or more targeted applications, programs, functions, or other assemblages of code, which may be written in one of multiple computing languages, into an intermediate language (hereafter “IL”) or bytecode. IL is typically independent of the platform, and the central processing unit (hereafter “CPU”) executes IL. In fact, IL is a higher level language than many CPU machine languages.
As an execution platform, a runtime execution environment may interpret compiled IL into native machine instructions. A runtime execution environment may utilize either an interpreter or a compiler to execute such instructions. Regardless, the native machine instructions may then be directly executed by the CPU. Since IL is CPU-independent, IL may execute on any CPU platform as long as the OS running on that CPU platform hosts an appropriate runtime execution environment.
Alternatively, at least portions of applications, programs, functions, or other assemblages of code may be precompiled and loaded as one or more native image files in the runtime execution environment, thus circumventing CPU consumption required for compilation. Effectively, the precompiled portions are software modules that are distributed in an IL format (e.g., assemblies, methods, or types) rather than in a native platform execution format. A source of such precompiled IL may be disposed in either of a non-managed execution environment or a separate implementation of a runtime execution environment on a same or separate one of devices 105, 110, and 115. The source may deploy the precompiled IL during or before install time for the application, program, method, function, or other assemblage of code to which the precompiled IL corresponds.
Regardless, examples of runtime environments include: Visual Basic runtime environment; Java® Virtual Machine runtime environment that is used to run, e.g., Java® routines; or Common Language Runtime (CLR) to compile, e.g., Microsoft .NET™ applications into machine language before executing a calling routine. However, this listing of runtime environments provides examples only. The example technologies described herein are not limited to just these managed execution environments. More particularly, the example implementations are not just limited to managed execution environments, for one or more examples may be implemented within testing environments and/or unmanaged execution environments.
An application, program, function, or other assemblage of code compiled into IL may be referred to as “managed code,” and that is why a runtime execution environment may be alternatively referred to as a “managed execution environment.” It is noted that code that does not utilize a runtime execution environment to execute may be referred to as a native code application.
A profiling application program interface (API) exposes one or more functions to the profiler 104. In the context of the example implementations described herein, the profiling API may be regarded as a language and message format provided by the managed execution environment to enable profiler 104 to communicate with the functionality in the managed execution environment. As shown in the exemplary system 200, the profiling API includes a callback interface 112 by which the CLR 102 notifies the profiler 104 of events and an information interface 116 by which the profiler 104 requests information from the CLR 102, typically in response to a callback.
Profiling shim 106 includes a callback interface 110 and an information interface 114. When the CLR 102 calls a function on the profiling shim's callback interface 110, the profiling shim 106 chains the call through to the profiler 104. When the profiler 104 calls a function on the profiling shim's information interface 114, the profiling shim 106 chains the call to the CLR 102. Before or after chaining a call, the profiling shim 106 may perform one or more actions. Since profiling shim 106 may be inserted as desired, the profiling shim 106 may add functionality without changing the code of the profiler 104.
For example, the profiling shim 106 may log one or more calls to one or more functions, such as callback functions or information functions. These logged calls may be used for various purposes including but not limited to measuring profiler overhead, getting a context for incorrect profiler behavior, and gaining insight into how the profiler uses the profiling API.
The profiling shim 106 may also be used to validate the profiler's usage of the profiling API. For example, the profiling shim may detect improper call sequences, change the behavior of profiling API functions for debugging, detect use of incorrect parameters, as well as perform other validation actions.
The profiling shim 106 may enable a profiler to attach to an already running program. A user may launch a program with the profiling shim registered as the program's profiler. Then, when the profiler 104 is attached to the profiling shim 106, the profiler 104 may begin profiling without further delay. In addition to the examples described above, other functionality may be performed by the profiling shim 106 as desired.
While the invention has been described in terms of several exemplary implementations, those of ordinary skill in the art will recognize that the invention is not limited to the implementations described, but can be practiced with modification and alteration within the spirit and scope of the appended claims. The description is thus to be regarded as illustrative instead of limiting.
|Cited Patent||Filing date||Publication date||Applicant||Title|
|US5787245 *||Nov 13, 1995||Jul 28, 1998||Object Technology Licensing Corporation||Portable debugging service utilizing a client debugger object and a server debugger object|
|US7086064 *||Aug 2, 2000||Aug 1, 2006||International Business Machines Corporation||Performance profiling tool|
|US7512934 *||Aug 25, 2004||Mar 31, 2009||Microsoft Corporation||Parallel debugger|
|US7716643 *||May 20, 2005||May 11, 2010||Microsoft Corporation||Methods and apparatus for software profiling|
|US20070169003 *||Jan 12, 2006||Jul 19, 2007||International Business Machines Corporation||Selective profiling of program code executing in a runtime environment|
|1||*||Christof Schmalenbach and Christian Höfig, The Java Virtual Machine Profiler Interface, Jul. 1, 2004, http://www.ddj.com/java/184405722.|
|2||*||David Browne, forum post, Jun. 11, 2004, retrieved Nov. 20, 2009; 2 pages.|
|3||*||JavaTM Virtual Machine Profiler Interface (JVMPI), Technical Documentation, http://java.sun.com/j2se/1.3/docs/guide/jvmpi/jvmpi.html, page archived Aug. 31, 2005 on archive.org.|
|4||*||Msdn, .Net Framework 4, Profiling Overview; retrieved Jun. 15, 2009; 7 pages.|
|Citing Patent||Filing date||Publication date||Applicant||Title|
|US9372779||May 2, 2014||Jun 21, 2016||International Business Machines Corporation||System, method, apparatus and computer program for automatic evaluation of user interfaces in software programs|
|US20090172645 *||Dec 27, 2007||Jul 2, 2009||Sap Ag||Call stack evaluation to assure proper framework access|
|U.S. Classification||717/127, 717/126, 719/328, 717/124, 717/130|
|Cooperative Classification||G06F11/348, G06F11/3495, G06F11/3409, G06F11/3476|
|European Classification||G06F11/34T12, G06F11/34C, G06F11/34T6, G06F11/34T4|
|Jun 21, 2006||AS||Assignment|
Owner name: MICROSOFT CORPORATION, WASHINGTON
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:KELJO, JONATHAN W.;REEL/FRAME:017824/0920
Effective date: 20060523
|Aug 8, 2014||REMI||Maintenance fee reminder mailed|
|Dec 9, 2014||AS||Assignment|
Owner name: MICROSOFT TECHNOLOGY LICENSING, LLC, WASHINGTON
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MICROSOFT CORPORATION;REEL/FRAME:034542/0001
Effective date: 20141014
|Dec 28, 2014||LAPS||Lapse for failure to pay maintenance fees|
|Feb 17, 2015||FP||Expired due to failure to pay maintenance fee|
Effective date: 20141228