|Publication number||US7739668 B2|
|Application number||US 11/383,430|
|Publication date||Jun 15, 2010|
|Filing date||May 15, 2006|
|Priority date||May 16, 2005|
|Also published as||US20060259825|
|Publication number||11383430, 383430, US 7739668 B2, US 7739668B2, US-B2-7739668, US7739668 B2, US7739668B2|
|Inventors||Brian Cruickshank, Oliver P. Sohm|
|Original Assignee||Texas Instruments Incorporated|
|Export Citation||BiBTeX, EndNote, RefMan|
|Patent Citations (24), Non-Patent Citations (8), Referenced by (11), Classifications (13), Legal Events (2)|
|External Links: USPTO, USPTO Assignment, Espacenet|
This application claims the benefit of Provisional Application Ser. No. 60/681,427 filed May 16, 2005, entitled “Debugging Software-Controlled Cache Coherence,” and Provisional Application Ser. No. 60/681,542, filed May 16, 2005, titled “Debug Profiling Applications,” and Provisional Application Ser. No. 60/681,561 filed May 16, 2005, titled “Debugging Applications with Overlays, Run-Time Relocatable Code and Multi-Tasking,” all of which are incorporated by reference herein as if reproduced in full below.
In order to look for errors in software programs (an activity referred to as “debugging”), some software development tools provide the ability to record the sequence of operations that a processor performed while executing a program. This is referred to as tracing the execution of the program, and the information that is captured is referred to as trace data. The trace data may comprise data such as the sequence of addresses executed by the processor, values of various processor registers at each executed instruction, and information in log files written by the traced program. The addresses of executed instructions are later correlated to the actual programs so that the opcodes executed at each instruction may be displayed for the user. In systems using virtual memory addressing, however, different tasks execute from the same set of virtual memory addresses making correlating the actual programs to the addresses of the executed instructions difficult.
The problems noted above are solved in large part by a method and system of profiling applications that use virtual memory. At least some of the illustrative embodiments are a computer-readable medium storing a program that, when executed by a processor of a host system, causes the processor to obtain values indicative of a plurality of states of virtual to physical memory mapping used by a memory management unit associated with a processor of a target system, and display an indication of a proportion of an execution time the processor of the target system dedicated to each of a plurality of tasks during the execution time, each task associated with a particular state of the virtual to physical memory mapping.
Other illustrative embodiments are methods comprising executing a traced program on a target system (the traced program comprising a plurality of tasks, each task using a different virtual to physical memory mapping), obtaining values indicative of a plurality of states of virtual to physical memory mapping used by a memory management unit associated with a processor of a target system, and displaying an indication of a proportion of an execution time the processor of the target system dedicated to each of a plurality of tasks and, optionally, some or all of the functions executed by those tasks during the execution time.
For a detailed description of exemplary embodiments of the invention, reference will now be made to the accompanying drawings in which:
Certain terms are used throughout the following description and claims to refer to particular system components. As one skilled in the art will appreciate, companies may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function.
In the following discussion and in the claims, the terms “including” and “comprising” are used in an open-ended fashion, and thus should be interpreted to mean “including, but not limited to . . . .” Also, the term “couple” or “couples” is intended to mean either an indirect or direct electrical connection. Thus, if a first device couples to a second device, that connection may be through a direct connection, or through an indirect connection via other devices and connections.
The following discussion is directed to various embodiments of the invention. Although one or more of these embodiments may be preferred, the embodiments disclosed should not be interpreted, or otherwise used, as limiting the scope of the disclosure, including the claims. In addition, one skilled in the art will understand that the following description has broad application, and the discussion of any embodiment is meant only to be exemplary of that embodiment, and not intended to intimate that the scope of the disclosure, including the claims, is limited to that embodiment.
The host computer 12 and target system 10 couple by way of one or more interconnects 14, such as cables. In some embodiments, the host computer 12 couples to target system 10 by way of a multi-pin cable 16, such as a Mictor cable available from Tektronix Texas, LLC of Richardson, Tex. The multi-pin cable 16 enables transfer of trace data files from the target system 10 to the host computer 12. In alternative embodiments, the host computer 12 couples to the target system 10 by way of a serial cable 18 across which the host computer 12 communicates with the joint test action group (JTAG) communication system, or other currently existing or after developed serial communication system. Serial communication between the host computer 12 and target system 10 on serial cable 18 has lower bandwidth than a multi-pin connection through illustrative cable 16. Thus, in embodiments that rely exclusively on the JTAG-based communications over serial cable 18, rather than trace or capture every event of a processor within a particular time frame, the statistical sampling subsystem (discussed more fully below) of the target system 10 is configured to statistically sample pertinent data, and transfer the statistically sampled data across the serial cable 18. In yet still further alternative embodiments, the multi-pin cable 16 may have two or more pins dedicated to serial communication, and thus the host computer 12 and target system 10 may communicate using multiple protocols, yet over the same multi-pin cable 16. In yet still other embodiments, the trace data may be captured on the target system and transferred to the host computer by any of a variety of now existing or after developed transport protocols, which allow the host computer to interact over a distance such that the host computer and target system need not be co-located (e.g., Ethernet, transmission control protocol/internet protocol (TCP/IP), institute of electrical and electronic engineers (IEEE) 1391 protocol, RS-232, and peripheral components interconnect (PCI)).
In accordance with some embodiments, the SOC 20 also comprises a trace system 28. The trace system 28 comprises a First In-First Out (FIFO) buffer 30 in which trace data is gathered. When operating in the trace mode the trace data is sent to the host computer 12 (
Still referring to
Referring simultaneously to
In response to assertion of the trigger signal 36, the trace system 28 collects the trace data in the FIFO buffer 30 (possibly together with events that occur prior to the trigger). Simultaneously with collecting, the trace system 28 sends the trace data to the host computer 12. In embodiments where all or substantially all the events after the assertion of the trigger signal 36 are part of the trace data, the trace system 28 sends the trace data over the relatively high bandwidth multi-pin cable 16. Other embodiments comprise sending the data over an optical interconnect to the host computer, or logging the captured trace data in memory or disk that is accessible by the target processor where it can be accessed by another program running on the target processor (e.g., an embedded software debugging program). Some of the illustrative trace data may be values indicative of a plurality of states of virtual to physical memory mapping, which requires a brief digression into the relationship between virtual memory and physical memory.
In order to keep track of the virtual to physical memory mapping, systems in accordance with embodiments of the invention utilize one more page tables (e.g., page table 29 (also
In systems using virtual memory addressing by the processor, many tasks may execute from the same virtual memory addresses. Thus, when viewing addresses of executed opcodes executed on a processor that uses a virtual memory system (where the debug-trace program externally correlates object code versions of the programs to the executed addresses), there is no easily discernable difference between the multiple tasks as they are executed from the same virtual addresses.
In order to assist the user of the debug-trace program 13 executed on the host computer 12 in differentiating tasks, in some embodiments of the invention the trace system 28 is configured to insert into the trace data values indicative of a plurality of possible states of the virtual to physical memory mapping used by the memory management system. The debug-trace program 13 executing on the host computer 12 extracts the values indicative of virtual to physical memory mapping from the trace data, which enables the debug-trace program to identify which tasks were executed.
Still referring to
In embodiments where the trace system 28 couples to the host computer 12 by way of the relatively high bandwidth connection, the trace system 28 is configured to monitor the value in the target state register 23, 38 and send the value to the host computer system 12 in a message wrapping protocol that identifies to the host computer 12 that the information is the value of the target state register 23, 38. Thus, in these embodiments the values in the target state register are sent across the high bandwidth cable 16 along with other trace data (e.g., direct memory access (DMA) trace data, cache memory trace data, addresses of opcodes executed by the processor 22 (the program counter values), the value of hardware registers in the processor 22, and interrupts received by the processor 22).
In accordance with at least some embodiments of the invention, when the operating system instantiates a new task and sets the page table for that particular task, the operating system also writes a value to the target state register 23, 38 that is indicative of the active page table. In embodiments where the number of possible page tables is low, the operating system writes the value indicative of the page table to the target state register 23, 38 in any predetermined fashion. The newly written target state register value is then sent to the host computer 12 for use by the debug-trace program 13. In situations where portions of the target state register 23, 38 are used for imparting other information, the various portions of the target state register 23, 38 may be divided into sections, one section applicable to indicating the virtual to physical memory mapping.
In order to address situations where there are a large number of page tables and/or the bits of the target state register 23, 38 are dedicated to other purposes, and in accordance with some embodiments, the operating system writes an indication of the state of the virtual to physical memory mapping to a log buffer. A log buffer may be equivalently referred to as a data table, data array and/or data structure. In some embodiments, data from the log buffer is read out by the host computer 12 after execution of the target or traced program has stopped. In situations where the log buffer does not contain a sufficient number of storage locations to store all the log data written during a trace period (e.g., log buffer has too few locations, or the log buffer is circular and the number of entries expected will overwrite earlier entries during the trace period), the log buffer may be read by the host computer 12 one or more times during the trace period to ensure all the entries generated are available to the debug-trace program.
In some embodiments, the trace system 28, in addition to the FIFO buffer 30, implements a series of memory locations 31 (
The logical construction of the log buffer may take many forms. In some embodiments, the log buffer is implemented as a plurality of equivalently sized data fields. In alternative embodiments, the log buffer is implemented as a plurality of arbitrary sized data fields. In yet still other embodiments, the log buffer is a table having a plurality of rows and columns. Regardless of the logical construction of the log buffer, in accordance with embodiments of the invention at least some entries in the log buffer comprises an indication of the state of the virtual to physical memory mapping and an index value. The index value is an index into the log buffer that identifies the location of the entry in the log buffer. The index value could be, for example, a pointer, packet number, sequence number, row number or any other value indicative of the location of the entry. In some embodiments, the index value is an inherent part of the entry, and in other embodiments the index value is generated and written by the operating system.
In addition to writing the indication of the state of the virtual to physical memory mapping and possibly the index value to the log buffer 31, the operating system in accordance with embodiments of the invention also places the index value in the target state register 23, 38. Writing the index value to the target state register contemporaneously with writing the log buffer ensures that the index value is present in the trace data associated with the traced program. In accordance with some embodiments, the debug-trace program 13 in host computer 12 reads the index value from the trace data, indexes into the log buffer data based on the index value, and thus obtains an indication of the active page table.
The debug-trace program 13 may read the page tables indicated by the target state register 23, 38, or the page tables indicated by the combination of an index value in the target state register 23, 38 and the log buffer 31. In some embodiments, the debug-trace program reads the indicated page table during execution of the traced program. In alternative embodiments, the debug-trace program 13 reads relevant page tables after execution of the traced program has stopped.
In other embodiments, rather than using a plurality of pre-constructed page tables, the operating system of the target system modifies the page table prior to instantiating each new task. In these embodiments, the operating system of the target system is configured to provide to the debug-trace program 13 an indication of the changes made to the page table. In some embodiments, the indication of the changes is written to the target state register 23, 38. In embodiments where the changes are too large to convey purely through the target state register 23, 38, the operating system may write the changes to the log buffer 31, and write an index value to the target state register 23, 38. The debug-trace program 13 may read the log buffer as the traced program is executing, or after execution of the traced program has stopped. Using the information (whether from the target state register 23, 38 directly, or from one or more entries in the log buffer), the debug-trace program 13 reconstructs the page table, and thus identifies the particular task executed during that period of the execution time. Attention now turns to how the debug-trace program 13 uses the information regarding the state of the virtual to physical memory mapping.
In software programs having multiple tasks, one or more of the tasks may consume excessive processor time and slow overall system performance. A debug-trace program in accordance with embodiments of the invention uses the values indicative of state of the virtual to physical memory mapping to identify which tasks (and their underlying functions, if any) have executed on the target processor to generate and display an indication of a proportion of an execution time the target processor dedicated to each task (and in some cases functions of a task) during the execution time.
Still referring to
The embodiments discussed to this point utilize trace data gathered by the trace system 28 and either stored in the target system for use by an embedded debugger, or transferred over one or both of serial cable 18 or the multi-pin cable 16; however, in alternative embodiments the SOC 20 either does not have the ability to gather all the pertinent trace data (e.g., a low cost SOC 20 that does not have the trace system 28, data flattener 32 and event trigger system 34), or the user of the debug-trace program 13 is interested in a smaller subset of the data (possibly in close to real time). Referring again to
When statistical profiling, the statistical sample system 80 is configured to periodically read the value of the program counter (which contains the address of the next opcode to execute) from the program counter register 39 and send the value of the program counter to the host computer 12. As discussed above, addresses alone may be insufficient to identify which task the addresses of the program counter represent. In order to address this concern, the alternative embodiments send the value in the target state register 23, 38 in place of the value of the program counter when the value (or a portion thereof) in the target state register 23, 38 is newly written with a value indicative of the state of the virtual to physical memory mapping.
Still referring to
Differentiating the program counter value from the value of the target state register in the host computer 12 takes advantage of the fact that in accordance with at least some embodiments the target system 10 operates based on 16 bit (two byte) instructions aligned on even byte boundaries. Thus, the value of the program counter in accordance with these embodiments consistently has an even value, meaning that the least significant bit of the program counter is zero. In order to differentiate a program counter value from a value from the target state register, the least significant bit of the value of the target state register is assigned to be a logic “1”. Other systems for differentiating program counter values from values of the target state register may be equivalently used.
Using these tools, the host computer 12 (and in particular the debug-trace program 13) may get a statistical sample of values of the program counter during execution of the traced program, and each value of the target state register 23, 38 during the executed program. The program counter values associated with the task identified by the preceding target state register value may be correlated with symbol information associated with the program and software modules that are being executed by that task in order to determine the relative amount of time spent in each of that task's functions. From this information, the debug-trace program 13 builds a display having an indication of a proportion of an execution time of the target processor dedicated to each task (and/or function within each task). Although not as exact as the embodiments where each executed address is captured, the embodiments performing statistically sampling still may generate and display indications, such as illustrated in
In situations where the value indicative of the identity of each task is written directly to the target state register, these embodiments enable a substantially real time view of the proportion of the execution time the target processor dedicates to each task (provided the debug-trace program already has copies of the page tables). In embodiments where the debug-trace program has to read the page tables, or the value in the target state register 23, 38 is an index value to a log buffer, the host computer 12 may substantially simultaneously read the log buffer (e.g., log buffer 31) and page tables, and build the display. In yet still other embodiments, the host computer 12 may read the values at the predetermined read location, but not read the log buffer and page tables until after execution of the traced program has stopped, and thus the illustrative displays may be constructed after the host computer 12 has read the log buffer.
Regardless of the precise mechanism by which the values indicative of the state of virtual to physical memory mapping are acquired, the next illustrative step is displaying an indication of a proportion of an execution time of the target processor was dedicated to each task (block 712), and thereafter the method ends (block 716). In embodiments where the host computer 12 receives a full set of trace data, displaying the indication may involve creating columns in the displayed trace data (such as columns 66 and 68 of
From the description provided herein, those skilled in the art are readily able to combine software created as described from the methods with appropriate general purpose or special purpose computer hardware to create a computer system and/or computer subcomponents embodying the invention, to create a computer system and/or computer subcomponents for carrying out the method of the invention, and/or to create a computer-readable medium for storing a software program to implement the method aspects of the invention. The computer readable medium could be, for example, a volatile memory, a non-volatile memory, a compact disc read only memory (CDROM), an electrically erasable programmable read only memory (EEPROM), a hard drive, and the like.
The above discussion is meant to be illustrative of the principles and various embodiments of the present invention. Numerous variations and modifications will become apparent to those skilled in the art once the above disclosure is fully appreciated. For example, although the discussion has assumed that the operating system is responsible for writing the target state register and/or the log buffer, in alterative embodiments the task and/or function itself may write the pertinent information when executed. It is intended that the following claims be interpreted to embrace all such variations and modifications.
|Cited Patent||Filing date||Publication date||Applicant||Title|
|US5870611 *||Nov 21, 1997||Feb 9, 1999||International Business Machines Corporation||Install plan object for network installation of application programs|
|US5930830 *||Jan 13, 1997||Jul 27, 1999||International Business Machines Corporation||System and method for concatenating discontiguous memory pages|
|US6513155 *||Jun 30, 1999||Jan 28, 2003||International Business Machines Corporation||Method and system for merging event-based data and sampled data into postprocessed trace output|
|US6519766 *||Jun 15, 1999||Feb 11, 2003||Isogon Corporation||Computer program profiler|
|US6523102 *||Apr 14, 2000||Feb 18, 2003||Interactive Silicon, Inc.||Parallel compression/decompression system and method for implementation of in-memory compressed cache improving storage density and access speed for industry standard memory subsystems and in-line memory modules|
|US6553564 *||Jun 30, 1999||Apr 22, 2003||International Business Machines Corporation||Process and system for merging trace data for primarily interpreted methods|
|US6634020 *||Mar 24, 2000||Oct 14, 2003||International Business Machines Corporation||Uninitialized memory watch|
|US6728949 *||Dec 14, 1999||Apr 27, 2004||International Business Machines Corporation||Method and system for periodic trace sampling using a mask to qualify trace data|
|US6754856 *||Dec 22, 2000||Jun 22, 2004||Stmicroelectronics S.A.||Memory access debug facility|
|US6865157 *||May 26, 2000||Mar 8, 2005||Emc Corporation||Fault tolerant shared system resource with communications passthrough providing high availability communications|
|US6871341 *||Mar 24, 2000||Mar 22, 2005||Intel Corporation||Adaptive scheduling of function cells in dynamic reconfigurable logic|
|US6901581 *||Oct 2, 2002||May 31, 2005||Eridon Corporation||Method for software debugging via simulated re-execution of a computer program|
|US6976252 *||May 17, 2002||Dec 13, 2005||Hewlett-Packard Development Company, L.P.||Systems and methods for driver installation|
|US6988263 *||Jul 10, 2000||Jan 17, 2006||International Business Machines Corporation||Apparatus and method for cataloging symbolic data for use in performance analysis of computer programs|
|US7024660 *||Oct 29, 2001||Apr 4, 2006||National Instruments Corporation||Debugging a program intended to execute on a reconfigurable device using a test feed-through configuration|
|US7089537 *||Sep 15, 2003||Aug 8, 2006||Microsoft Corporation||System and method for performing path-sensitive value flow analysis on a program|
|US7146611 *||Feb 24, 2003||Dec 5, 2006||Hewlett-Packard Development Company, L.P.||Method and system for managing memory for software modules|
|US7257805 *||Nov 9, 2001||Aug 14, 2007||International Business Machines Corporation||Restoring debugging breakpoints subsequent to program code modifications|
|US7263690 *||Nov 14, 2003||Aug 28, 2007||Sun Microsystems, Inc.||Mechanism for safe byte code in a tracing framework|
|US7293142 *||Apr 19, 2004||Nov 6, 2007||Cisco Technology, Inc.||Memory leak detection system and method using contingency analysis|
|US7487321 *||Feb 15, 2005||Feb 3, 2009||Cisco Technology, Inc.||Method and system for memory leak detection|
|US7536680 *||Dec 31, 2002||May 19, 2009||International Business Machines Corporation||Method for modifying a class file to monitor data flow|
|US7581211 *||Jul 14, 2004||Aug 25, 2009||International Business Machines Corporation||Method and apparatus for on demand debugging, tracing, and logging of applications|
|US7584458 *||Oct 2, 2003||Sep 1, 2009||Microsoft Corporation||Source code annotation language|
|1||"ETM 10 (Rev 0) Technical Reference Manual"; 94 pp; Document No. ARM DDI 0206A; © 2001 ARM Limited.|
|2||*||Bao et al, "HMTT: A platform independent full system memory trace monitoring system", ACM SIGMETRICS, pp. 229-240, 2008.|
|3||*||Baskaran et al, "Automatic data movement and computation mapping for multi level parallel architecture with explictly managed memories", ACM PPpOO, pp. 1-10, 2008.|
|4||*||Jones et al, "Improving the scalability of parallel job by adding parallel awareness to the operating system", ACM/IEEE SC, pp. 1- 20, 2003.|
|5||*||Lee et al, "A flexible memory mapping scheme for parallel turbo decoders with periodic interleavers", IEEE, pp. 651-654, 2007.|
|6||*||Lee et al, "Matching output queueing with multiple input/output queued switch", IEEE, pp. 121-132, 2006.|
|7||*||Millard et al, "Run time support and storage management for memory mapped persistent object", IEEE, pp. 508-515, 1993.|
|8||Swain, Andrew and Horley, John; "ARM Summary of New Features in ETMv3"; Jan. 31, 2005; 14 pp.; Document no. PRD08-PRDC-003049 3 2; © ARM Limited 2004-2005.|
|Citing Patent||Filing date||Publication date||Applicant||Title|
|US8490061 *||May 7, 2009||Jul 16, 2013||International Business Machines Corporation||Profiling application performance according to data structure|
|US8504993 *||Dec 29, 2006||Aug 6, 2013||Intel Corporation||Virtualization of micro-code patches for probe less debug|
|US8694970 *||Jun 2, 2005||Apr 8, 2014||Seagate Technology Llc||Unified debug system with multiple user-configurable trace volumes and trace buffers|
|US8793694 *||Feb 26, 2009||Jul 29, 2014||International Business Machines Corporation||Policy driven autonomic performance data collection|
|US8850394 *||May 7, 2009||Sep 30, 2014||Icera Inc.||Debugging system and method|
|US20060277441 *||Jun 2, 2005||Dec 7, 2006||Seagate Technology Llc||Unified debug system with multiple user-configurable trace volumes and trace buffers|
|US20080127102 *||Sep 14, 2006||May 29, 2008||Glen J Anderson||Technique to visually present memory location and usage during code execution|
|US20080163186 *||Dec 29, 2006||Jul 3, 2008||Ramesh Devarajan||Virtualization of micro-code patches for probe less debug|
|US20090282294 *||Nov 12, 2009||David Alan Edwards||Debugging System and Method|
|US20100218188 *||Aug 26, 2010||International Business Machines Corporation||Policy driven autonomic performance data collection|
|US20100287536 *||May 7, 2009||Nov 11, 2010||International Business Machiness Corporation||Profiling application performance according to data structure|
|U.S. Classification||717/128, 711/170|
|International Classification||G06F9/45, G06F9/44|
|Cooperative Classification||G06F2201/88, G06F11/3471, G06F2201/815, G06F11/3636, G06F11/3476, G06F11/3419|
|European Classification||G06F11/36B5, G06F11/34C4, G06F11/34T2|
|Jun 20, 2006||AS||Assignment|
Owner name: TEXAS INSTRUMENTS, INC., TEXAS
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:CRUICKSHANK, BRIAN;SOHM, OLIVER P.;REEL/FRAME:017826/0332;SIGNING DATES FROM 20060510 TO 20060511
Owner name: TEXAS INSTRUMENTS, INC.,TEXAS
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:CRUICKSHANK, BRIAN;SOHM, OLIVER P.;SIGNING DATES FROM 20060510 TO 20060511;REEL/FRAME:017826/0332
|Nov 26, 2013||FPAY||Fee payment|
Year of fee payment: 4