This application is based upon and claims the benefit of priority from Japanese Patent Application No. 2015-162817, filed on Aug. 20, 2015; the entire contents of which are incorporated herein by reference.
Embodiments described herein relate generally to system, a method, and a program product for trace information management.
Trace information constituted by characteristic values observable during execution of a source code (program) and an execution sequence thereof is used for various purposes. The trace information is used for, for example, verification of the source code and visualization of execution states of the source code. Techniques for dealing with the trace information include a technique in which data and metadata of the trace information are separately stored, and identification information as information for linking the data and the metadata is added to a set of a probe and a user in the source code.
The amount of trace information varies with, for example, the size of the source code and a granularity set when the trace information is generated. For example, a larger size of the source code or a finer granularity increases the amount of trace information. The trace information includes information unnecessary for the purpose of use thereof, in some cases.
In conventional techniques, when certain processing is performed using acquired trace information, the trace information having a granularity set at generation thereof is used without modification. In other words, if the granularity of the trace information is finer than that necessary for the purpose of use of the trace information, the trace information as acquired needs to be referred to even with, for example, unnecessary information included therein. Due to his, if the amount of trace information is very large, a system performing the intended processing is subjected to an excessively large processing load, so that problems arise, such as a reduction in an operational efficiency.
The acquirer 11 acquires trace information and attribute information.
The trace information 61 is generated based on the source code 51, and includes characteristic values observable during execution of the source code 51 and an execution sequence of the source code 51. The characteristic values are information indicating behaviors that have occurred during the execution of the source code 51, and are, for example, time when a scope started and time when the scope ended. The characteristic values are not limited to these examples. The scope is a range defined in the source code and is a range corresponding to, for example, a portion put in braces { }, such as a function (main, funcA, or funcB), a conditional statement (if), or a loop statement (for). The way of defining the scope is not limited to these examples. The definition can be appropriately made in accordance with the form of the source code 51. The scope may be defined, for example, by specifying any continuous section in the source code 51 using, for example, a file name or line numbers. Alternatively, a special language-neutral control structure for this system may be embedded in the source code 51 or a binary code compiled therefrom, and the scope may be defined based on the timing of start and end of the structure. One scope may include one or more scopes.
In the source code 51 illustrated in
The trace information 61 illustrated in
In the trace information 61 illustrated in
The attribute information 71 indicates the characteristic values of the scopes, scope by scope. Each of the characteristic values of the scopes is a value indicating the characteristic of the scope, such as an execution count and an execution period (such as the number of instruction-execution cycles or the elapsed time) of the scope. The characteristic value of the scope is not limited to these examples.
The attribute information 71 illustrated in
In the attribute information 71 illustrated in
By using the information, such as the attribute information 71 described above, obtained by aggregating the characteristic values scope ID 63 by scope ID 63, the entire trace information 61 can be overviewed. In this example, the number of the records 62 of the trace information 61 is not so large. However, if the number of the records 62 is tens of thousands hundreds of millions, the overall picture of the trace information 61 is very difficult to be understood. In such cases, using the attribute information 71 as described above enables precise understanding of the overall picture of the trace information 61.
The acquirer 11 is configured using, for example, the CPU 21, a control program, logic integrated circuits (ICs), and the RAM 23. The term “acquire” as used herein includes receiving data from the outside and internally generating data. In other words, the trace information 61 and the attribute information 71 may be generated by a system (device other than the trace information management system 1, or may be generated in the trace information management system 1. The method for generating the trace information 61 and the attribute information 71 is not limited. The trace information 61 and the attribute information 71 only need to be appropriately generated using a known or new technique.
The source code 51 as a target of acquisition by the acquirer 11 may be written in a programming language unique to a particular processing unit. The source cod 51 may be a result of conversion, for example, into a binary form that has been compiled, for example, by some kind of compiler device and is executable on a particular computer device, into an intermediate expression form used in the compiler device or the computer device, or into a form of an assembly language or the like. The source code 51 may be, for example, an application program that operates under an environment of some kind of operating system or the like, a program that serves as an operating system or an infrastructure system, or a program that serves as a device driver or the like for operating hardware. The source code 51 need not necessarily be one file containing all information, but may include a plurality of files corresponding to a plurality of pieces of divided information. In this manner, the source code 51 only needs to have a form that allows generation of the trace information 61 using a known or new technique.
The trace information 61 may include, as information on the characteristic values, information on, for example, how many times of memory access have occurred at the timing when a record 62 was previously generated and at the timing when a section of a function or t like in the source code 51 ended, which memory was accessed, how much memory was used at what timing, when the memory was allocated, and when the memory was freed. The trace information 61 may include information on a file name and a line number indicating a location in the source code 51 where a behavior related to a characteristic value has occurred, and on a path and a server indicating a location where the source code 51 is present. The trace information 61 may include names given to regions defined by surrounding continuous sections of the source code 51 with block-like structures of the programming language. The trace information 61 may include information identifying a version of the source code 51 using, for example, an ID assigned to each particular section and an ID issued in a source code management system. The trace information 61 may include IDs each of which is uniquely given each time the record 62 is generated. The trace information 61 can include any number of pieces of information on the characteristic values. A plurality of pieces of the trace information 61 may be obtained as a result of executing a plurality of times the same source code 51 under different conditions. In this manner, the trace information 61 only needs to be generated so as to include information on the various characteristic values using a known or new technique.
The specifier 12 specifies at least one of the scope IDs 63 from the attribute information 71 acquired. Information indicating the specified scope ID (or IDs) 63 is output from the specifier 12 as specifying information used for extraction processing by the extractor 13. The specifier 12 is configured using, for example, the CPU 21, a control program, logic ICs, the output device (such as the display), and the input device (such as the keyboard, the mouse, and/or the touchscreen panel). For example, a user may specify desired one or more of the scope ID 63 from the attribute information 71 displayed on the display of the computer. The CPU 21 may perform processing to automatically specify a scope or copes having characteristic values (such as the execution count and the execution period) satisfying predetermined conditions. In this manner, at least one of the scope IDs 63 only needs to be specified from the attribute information 71 using a known or new technique.
The extractor 13 generates extracted information by extracting information corresponding to the specified scope ID (or IDs) 63 from the trace information 61 based on the specifying information output from the specifier 12.
The extractor 13 is configured using, for example, the CPU 21, a control program, and logic ICs. As described above, when a scope ID 63 is specified from the attribute information 71, records 62 including the scope ID 63 are extracted from the trace information 61. The processing to extract the records 62 from the trace information 61 can be performed by appropriately using a known or new search algorithm. The method for creating the extracted information 81 in the extractor 13 is not limited the example described above. For example, instead of removing unnecessary records 62, a mark such as a flag may be added to each of the records 62 including the specified scope ID 63 so as to be able to identify desired records 62 when the extracted information 81 is used. The records 62 may be extracted not only from one piece of trace information 61, but also from a plurality of pieces of trace information 61, and the extracted records 62 may be grouped on a piece-by-piece basis of the trace information 61. The records 62 extracted from all pieces of trace information 61 may be grouped together into one group.
Using the trace information management system 1 described above can facilitate examination of, for example, a problematic part. Storing a large amount of information on the characteristic values in the trace information 61 enables finding of changes in the characteristic values related to a problem during the execution of the program, and further enables extraction, cause analysis, and correction of the problematic part. However, increase in the amount of the trace information 61 makes it difficult to detect the problematic part from the trace information 61. Thus, using first the attribute information 71 in which the characteristic values are aggregated scope ID 63 by scope ID 63, characteristic values related to the problem to be solved are examined. For example, when a certain function is executed a million times, and another function is executed ten times, the trace information 61 stores therein a million and ten pieces of information at each of the start and the end of the function, so that two million and twenty records 62 are generated. It is very difficult to detect the problem while checking all the records 62. However, by using the attribute information 71 to understand that the problem is likely to lie in the function executed only ten times, and by specifying the scope ID 63 corresponding to the function, the number of records 62 included in the extracted information 61 results in 20, so that the number of targets of the examination can be greatly reduced. Then, close examination of the characteristic values stored in the twenty records 62 enables examination f whether the problem always occurs or only occurs during executions at certain timing, and thus enables easy attainment of more detailed information leading to extraction, cause analysis, and correction of the problematic part.
The extracted information 81 generated as described above can be used for various purposes. The extracted information 81 may be output without modification to, for example, a display of a computer, and may be provided to other systems, such as a system for verifying the source code 51 and a system for visualizing execution states of the source code 51.
The hardware configuration illustrated in
Although FIG. I illustrates the configuration in which the acquirer 11, the specifier 12, and extractor 13 serving as the most basic functional blocks of the trace information management system 1 are connected in the order of processing, embodiments are not limited to this configuration. The embodiments may have, for example, a configuration in which the functional blocks operate in parallel in cooperation with one another, a configuration in which the order of the functional blocks are interchanged with one another, a configuration in which each of the functional blocks is divided into a plurality of blocks, or a combined configuration of these three configurations.
A program that carries out the functions of the trace information management system 1 can be recorded on a computer-readable recording medium, such as a CD-ROM, a flexible disk (FD), a CD-R, or a DVD, as a file in an installable format or an executable format, and can be provided, for example, via the drive device 29. The program may be provided by being downloaded from a certain storage device connected to a network to a certain computer, or may be provided to a certain information processing device by being incorporated in a ROM or the like in advance. The program may be constituted by a plurality of modules for performing the above-described functions of the acquirer 11, the specifier 12, and extractor 13.
According to the trace information management system 1 described above, a granularity of the trace information 61 can be changed from that at the time of acquisition of the trace information 61 by using the attribute information 71 obtained by aggregating the characteristic values for each scope ID 63 for identifying a scope. This makes it easier to understand the overall picture of the trace information 61 with a very large amount of information, and enables efficient extraction of necessary information from the trace information 61.
The following describes a second embodiment with reference to the drawings. The same reference numerals will be assigned to the same or similar parts as or to those of the first embodiment, and the description thereof will not be repeated in some cases.
The first embodiment has illustrated the configuration in which the granularity of the trace information 61 is adjusted based on the scope ID 63. The second embodiment will illustrate a configuration in which the granularity of trace information is adjusted further based on calling relations among a plurality of scopes.
Each of the scope IDs 63 (A, B, C, and D) in the second embodiment is a symbol uniquely set for each function in the source code 91. “A” corresponds to the “function main”, “B” to the “function funcA”, and “C” to the “function funcB”, and “D” to the “function funcC”. That is, in the present embodiment, the scope ID 63 is not assigned to processing in statement blocks(such as loop statement blocks and conditional statement blocks) other than the functions. Such a way of assignment of the scope ID 63 is merely an example, and the embodiments need not be limited to this example.
The calling relation IDs 103 “1” to “5” illustrated in
The nodes 1001 to 1003 of the tree structure information 111 indicate that the functions funcA and funcB are called from the function main. The nodes 1002 and 1004 indicate that the function funcC is called from the function funcA. The nodes 1003 and 1005 indicate that the function funcC is called from the function funcB.
The calling relation IDs 103 “1” to “5” included in the records 102 illustrated in
In the trace information 101 illustrated in
The first attribute information 121 illustrated in
The second attribute information 131 illustrated in
The second attribute information 131 of this example specifically indicates the following states. “1,A,1,999” on the first line indicates that the node 1001 corresponding to the function main (scope ID 63 “A”) called first is executed once in the entire period, and the average execution period thereof is 999 cycles. “2,B,3,100” on the second line indicates that the node 1002 corresponding to the function funcA (scope ID 63 “B”) called from the function main is executed three times in the entire period, and the average execution period for one execution is 100 cycles. “3,C,3,200” on the third line indicates that the node 1003 corresponding to the function funcB (scope ID 63 “C”) called from the function main is executed three times in the entire period, and the average execution period for one execution is 200 cycles. “4,D,3,10” on the fourth line indicates that the node 1004 corresponding to the function funcC (scope ID 63 “D”) called from the function funcA is executed three times in the entire period, and the average execution period for one execution is 10 cycles. “5,D,3,20” on the fifth line indicates that the node 1005 corresponding to the function funcC (scope ID 63 “D”) called from the function funcB is executed three times in the entire period, and the average execution period for one execution is 20 cycles.
In the second attribute information 131 described above, the value of the average execution period information 76 differs between the fourth line and the fifth line. Hence, it is found that the same function funcC changes in behavior in accordance with the caller (the function funcA or the function funcB). Such a determination is made not only by information indicated in “D,funcC,6,15” on the fourth line of the first attribute information 121.
The information stored in the first attribute information 121 and the second attribute information 131 is not limited to information obtained by aggregating the characteristic values in the scopes and the nodes 1001 to 1005. The scopes or the nodes 1001 to 1005 overlap when, for example, a scope calls another scope. In such a case, information other than that of target scopes or target nodes can be ignored by ignoring the overlapped information, or by specifying th depth or relativity of the calling relation. For example, considered is a case in which the function funcB is called from the function funcA as illustrated in
The specifier 12 in the present embodiment uses both the first attribute information 121 and the second attribute information 131 to generate the specifying information used for the extraction processing by the extractor 13.
The first extracted information 141 illustrated in
The second extracted information 151 illustrated in
For example, a problematic part can be more easily examined by use of the trace information management system 1 in the present embodiment. For example, considered is a case in which a function has been executed a million times, during which the function has been called from three functions of a function A, a function B, and a function C, 800000 times, 199990 times, and 10 times, respectively. In this case, the trace information 101 stores information obtained at the starts and ends of the million executions of the functions, and all pieces of the information serve as information indicating the results of the executions of the functions. Due to this, two million records 62 remain in the first extracted information 141, resulting in an insufficient narrowing of the information. However, using the calling relation IDs 103 can classify the million executions into three types based on callers of the functions. Thus, the extracted information (second extracted information 151) with the number of records 102 narrowed down to 20 can be generated by using the attribute information (second attribute information 131) aggregated for each calling relation ID 103 to understand that a problem is likely to lie, for example, in the ten executions called by the function C, and by specifying the calling relation ID 103 corresponding to the function. As a result, the number of targets of the examination can be greatly reduced. Then, close examination of the characteristic values stored in the 20 records 102 enables examination of whether the problem always occurs or only occurs during executions at certain timing, and thus enables easy attainment of more detailed information leading to extraction, cause analysis, and correction of the problematic part.
The first extracted information 141 and the second extracted information 151 generated in this manner can be used for various purposes in the same manner as the extracted information 81 in the first embodiment.
As described above, th granularity of the trace information 101 can be more effectively adjusted by extracting the desired information (records 102) from the trace information 101, using the first attribute information 121 created based on the information (scope IDs 63) for identifying the scopes, and also using the second attribute information 131 created based on the information (calling relation IDs 103) for identifying the calling locations in the tree structure information 111.
In this manner, using the attribute information created based on the various types of information enables understanding of the characteristics of the trace information (source code) from every point of view, and enables an increase in the degree of freedom of the granularity adjustment.
While certain embodiments have been described, these embodiments have been presented by way of example only, and are not intended o limit the scope of the inventions. Indeed, the novel embodiments described herein may be embodied in a variety of other forms; furthermore, various omissions, substitutions and changes in the form of the embodiments described herein may be made without departing from the spirit of the inventions. The accompanying claims and their equivalents are intended to cover such forms or modifications as would fall within the scope and spirit of the inventions.
Number | Date | Country | Kind |
---|---|---|---|
2015-162817 | Aug 2015 | JP | national |