Arithmetic unit idle time measurement device and program
The arithmetic unit idle time measurement device addresses the challenges of overhead and inaccurate state detection by using task management information to derive active/idle time progression, enhancing CPU power saving configurations and core allocation efficiency.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- NT T INC
- Filing Date
- 2024-11-21
- Publication Date
- 2026-05-28
Smart Images

Figure JP2024041341_28052026_PF_FP_ABST
Abstract
Description
Arithmetic Unit Idle Time Measurement Device and Program
[0001] The present invention relates to an arithmetic unit idle time measurement device and a program.
[0002] The CPU (Central Processing Unit) has a function to control the idle state of the CPU by hardware control, which is called LPI (Low Power Idle). LPI is often referred to as CPU idle or C-state. Hereinafter, LPI will be described as C-state. When the CPU load decreases, C-state tries to save power by turning off the power of a part of the CPU circuit (Patent Document 1 and Patent Document 2).
[0003] Patent Document 1 discloses a task scheduler device that takes C-state into consideration. The task scheduler device described in Patent Document 1 colors the "busy" CPU core group and the "idle" CPU core group in task management. The "busy" CPU core group is set to a shallow C-state, and the "idle" CPU core group is set to a deep C-state.
[0004] Patent Document 2 discloses a packet transfer system that takes CPU idle into consideration. The packet transfer system described in Patent Document 2 transitions to a deep C-state when the packet arrival frequency is sparse in the packet reception function unit, and predicts packet arrival and performs pre-wakeup to relax the return time from the deep C-state.
[0005] FIG. 47 is a diagram showing an example of the state of C-state in a table. Note that since the state definition varies depending on the CPU hardware, FIG. 47 is only a reference example. As shown in FIG. 47, there are grades C0 to C6 in the CPU idle state, and as the time with no CPU load becomes longer, it transitions to a deeper sleep state. The deeper sleep state has lower CPU power consumption, but on the other hand, the time required to return becomes longer, which may be a problem from the perspective of low latency.
[0006] The definition of C-states varies depending on the CPU hardware. For example, some models lack C4 and C5 states, while others have a state where C1 is followed by C1E. As the state deepens, the power saving effect increases, but the time required to recover from the idle state also increases. Furthermore, the depth to which the CPU idle state transitions is controlled by the CPU hardware and is product-dependent (often not controllable by software such as the kernel).
[0007] Existing technologies analyze application behavior by acquiring CPU performance counter information and monitoring application function call information at the OS / (where " / " means "or") middleware layer. The CPU performance counters mentioned above are the CPU core and the intra-core performance counters (PMU (Performance Monitoring Unit) / PMC (Performance Monitoring Counter)). Many CPUs are equipped with PMUs for the purpose of application optimization and performance measurement. For example, Intel CPUs are equipped with 4 to 8 PMCs per logical core, making it possible to dynamically acquire CPU core performance indicators. The items that can be acquired by PMCs are diverse, and it is possible to acquire information such as internal core behavior (core computation bottleneck, memory access bottleneck, intra-core instruction type utilization rate, etc.), CPU frequency, and uncore frequency.
[0008] Among CPU performance counters, PMC, which allows for dynamic changes in the data acquired, has a limited number of units per CPU core. Switching is necessary when acquiring more metrics than the number of PMC units available. Furthermore, instruction execution on the target core is required for data acquisition.
[0009] Figure 48 shows an example configuration of a general-purpose server for analyzing the operation of an application in progress. Each signal line arrow in Figure 48 is for illustrating the flow of dynamic analysis. As shown in Figure 48, the server 1 comprises hardware 10, an OS 20, and a user space 30. The hardware 10 comprises a CPU 11 having multiple CPU cores #m, CPU cores #l, ...
[0010] The OS 20 includes an OS function unit 21A that enables dynamic analysis, and a SystemCall Interface 25 between the OS 20 and the user space 30. The user space 30 contains an application A31 that is the target of motion analysis, and a dynamic analysis tool 32 such as perf.
[0011] In the above configuration, application A31 makes a system call to the SystemCall Interface 25 to perform function calls at the OS / middleware layer. The dynamic analysis tool 32 analyzes the behavior of the running application based on the acquired performance counters and system call information. The dynamic analysis tool 32 issues an analysis command to the OS function unit 21A, and the OS function unit 21A sends the acquired information to the dynamic analysis tool 32. The OS function unit 21A requests the SystemCall Interface 25 to acquire system call information from the SystemCall Interface 25. The OS function unit 21A acquires performance counter information from the CPU performance counter (not shown) installed on the CPU core of the CPU 11.
[0012] The dynamic analysis tool 32 works in conjunction with the OS function unit 21A to analyze the operation of application A31 by monitoring CPU performance counter information acquired by the OS function unit 21A and application function call information at the OS / middleware layer.
[0013] In the operational analysis of the above-mentioned applications, it is sometimes necessary to obtain information on the active / idle time progression of the arithmetic units during the application's computational processing. This information on active / idle time progression is useful for power saving and improving processing efficiency by configuring CPU power saving functions and allocating cores when running the application.
[0014] This section explains the active / idle time progression of the arithmetic unit and examples of its application. Figure 49 shows the CPU operating status (CPU active / idle). By detecting the idle time shown in Figure 49, it becomes possible to configure the CPU idle function appropriately for the idle time.
[0015] The upper part of Figure 50 shows the CPU activity (CPU active / idle) on the core where thread #k is running, and the lower part of Figure 50 shows the CPU activity (CPU active / idle) on the core where thread #n is running. As shown in Figure 50, the idle times of threads #k and #n do not coincide. In this case, the core settings are configured so that threads #k and #n are not assigned to SMT (Simultaneous Multi-Threading) on the same physical core. When using SMT to use one physical core as multiple logical cores, if the logical cores associated with the physical core do not enter an idle state simultaneously, it is not possible to transition to a deep C-state, thus losing the opportunity to reduce power consumption. Thus, active / idle time transition information is used when setting CPU power saving functions and assigning cores when running applications.
[0016] International Publication No. 2023 / 199519, International Publication No. 2024 / 013831
[0017] Conventional motion analysis methods make it difficult to accurately obtain the time progression of active time / idle time of a computing unit due to application calculations. As a result, problems such as (1)-(3) below occur.
[0018] (1) Due to the overhead of the observation itself, the arithmetic unit becomes active at what should be an idle time, making it impossible to monitor the true active / idle state due to the application's arithmetic processing (see Figure 51 below).
[0019] (2) It is not possible to observe a state where the application is idle, but the arithmetic unit is not idle due to processing related to the application (see Figure 52 below).
[0020] (3) To obtain the data accurately, it would be necessary to modify the application, such as by embedding tracing code within the application.
[0021] This section explains the problems with conventional observation techniques. Figure 51 illustrates problem (1) with conventional observation techniques using CPU operating status (CPU active / idle). When attempting to detect the idle time shown in the left figure of Figure 51, an observation operation indicated by symbol aa in the right figure of Figure 51 is required for idle time detection. This observation operation introduces overhead. A problem arises because the accurate active / idle status cannot be determined due to the observation operation.
[0022] Figure 52 illustrates the problem (2) of observation using conventional techniques, using CPU operating status (CPU active / idle). Figure 52 shows an example of event tracing being performed on a front-end thread within an application. The left side of Figure 52 shows the CPU operating status when the application's front-end (front-end thread) terminates and transitions to the back-end (back-end thread). The CPU operating status of the application's front-end drops from active to idle, while the CPU operating status of the application's back-end rises from idle to active. In other words, the application is in an idle state, but the processing related to the application prevents the arithmetic unit from being idle. Looking at this state from the observation result example shown in the right side of Figure 52, only the drop in CPU operating status from active to idle is observed, highlighting the problem that the actual operation transition of the CPU is not being observed. In this example, the back-end thread will always operate subsequently (bottom right of Figure 52), and the CPU's active time will actually be much longer. This leads to the problem that the actual operation transition of the CPU is not being observed. Thus, conventional motion analysis methods have the challenge of being unable to accurately obtain the time progression of active time / idle time of the computing unit due to application calculations.
[0023] In light of this background, the present invention was made, and its objective is to obtain the time progression of the active / idle state of a arithmetic unit due to the computational processing of an application, without modifying the application and with reduced overhead.
[0024] To solve the aforementioned problems, a arithmetic unit idle time measuring device is provided for measuring the active time while processing is being performed and the idle time while processing is paused in an arithmetic unit that is performing arithmetic processing of an application, and the device comprises: a task execution time information acquisition unit that acquires task management information including task execution time information from a task management unit that performs task management to assign tasks to the arithmetic unit; and an arithmetic unit operation status derivation unit that derives active or idle information of each arithmetic unit by the application based on the acquired task execution time information.
[0025] According to the present invention, the time progression of the active / idle state of a arithmetic unit due to the application's computational processing can be obtained without modifying the application and with reduced overhead.
[0026] This is a diagram illustrating the basic principle of the present invention. This is a diagram showing the time progression of CPU operation of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a schematic configuration diagram of an arithmetic unit idle time measurement system equipped with the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a configuration diagram showing the operation image of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a diagram showing an example of information placed in the shared memory of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a diagram showing an example of outputting the active / idle time progression based on the information placed in the shared memory of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a configuration diagram showing an implementation example using eBPF in the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a configuration diagram showing the operation image of the task execution time information acquisition unit of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a flowchart that is started every time immediately before issuing a CPU pause instruction for the task execution time information acquisition unit of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a flowchart that is started every time immediately after recovering from a CPU pause instruction for the task execution time information acquisition unit of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a configuration diagram showing the operation image of the arithmetic unit operation status derivation unit of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a flowchart showing the operation of the arithmetic unit operation status derivation unit of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a diagram showing an example of the correspondence between acquired information and output (end output) of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a diagram showing an example of the correspondence between information and output acquired at time T of the arithmetic unit idle time measurement device according to the first embodiment of the present invention (sequential output). This is a diagram showing an example of the correspondence between information and output acquired at time T+1 of the arithmetic unit idle time measurement device according to the first embodiment of the present invention (sequential output). This is a diagram showing an example of the correspondence between information and output acquired at time T+2 of the arithmetic unit idle time measurement device according to the first embodiment of the present invention (sequential output). This is a diagram showing an output image when the application N to be measured by the arithmetic unit idle time measurement device according to the first embodiment of the present invention has multiple processes and operates using multiple cores #m #l #k.This figure shows an example of text output from a arithmetic unit idle time measurement device according to the first embodiment of the present invention. This figure shows an example of text output from a arithmetic unit idle time measurement device according to the first embodiment of the present invention. This figure shows an example of text output from a arithmetic unit idle time measurement device according to the first embodiment of the present invention. This figure shows an example of text output from a arithmetic unit idle time measurement device according to the first embodiment of the present invention. This figure shows an example of text output from a arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a schematic configuration diagram of an arithmetic unit idle time measurement system equipped with a arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a configuration diagram showing an image of operation of a arithmetic unit idle time measurement device according to the second embodiment of the present invention. This figure shows an example of information placed in the shared memory of a arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a configuration diagram showing an implementation example using eBPF in a arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a configuration diagram showing an image of operation of the task execution time information acquisition unit of a arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a flowchart that is started every time immediately before the CPU pause instruction is issued by the task execution time information acquisition unit of a arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a flowchart that is started every time immediately after the CPU pause instruction is returned by the task execution time information acquisition unit of a arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a diagram showing the operation image of the arithmetic unit operation status derivation unit of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a flowchart showing the operation of the arithmetic unit operation status derivation unit of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a diagram showing an example of the correspondence between acquired information and output (end output) of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a diagram showing an example of the correspondence between information acquired at time T and output (sequential output) of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a diagram showing an example of the correspondence between information acquired at time T+1 and output (sequential output) of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This is a diagram showing an example of the correspondence between information acquired at time T+2 and output (sequential output) of the arithmetic unit idle time measurement device according to the second embodiment of the present invention.This figure shows an output image of the arithmetic unit idle time measurement device according to the second embodiment of the present invention when the application N to be measured has multiple processes and operates using multiple cores #m #l. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the second embodiment of the present invention. This diagram shows a schematic configuration of an arithmetic unit idle time measurement system equipped with the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an example of information placed in the shared memory of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an example of output output of the active / idle time transition based on the information placed in the shared memory of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This diagram shows a configuration example of implementation using eBPF in the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This diagram shows an operation image of the task execution time information acquisition unit of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This flowchart shows the operation of the task execution time information acquisition unit of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an example of entry in the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This is a diagram showing the operation image of the arithmetic unit operation status derivation unit of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This is a flowchart showing the operation of the arithmetic unit operation status derivation unit of the arithmetic unit idle time measurement device according to the first embodiment of the present invention. This is a diagram showing an example of the correspondence between acquired information and output (end output) of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This is a diagram showing an example of the correspondence between acquired information and output (sequential at time T+1.This figure shows an example of the correspondence between information acquired at time T+2 and output (sequential output) of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an output image (end output) when multiple tasks are running on one CPU core of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an example of text output of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This figure shows an output image (end output) when multiple tasks are running on one CPU core of the arithmetic unit idle time measurement device according to the third embodiment of the present invention. This is a hardware configuration diagram showing an example of a computer that implements the functions of the arithmetic unit idle time measurement device according to each embodiment of the present invention. This figure shows an example of the C-state state in a table. This figure shows an example of the configuration of a general-purpose server that analyzes the operation of an application in progress. This figure shows the CPU operating status (CPU active / idle). This figure shows the CPU operating status (CPU active / idle) on the core where threads #k and #n are running. This diagram explains the problem (1) of observation using conventional technology using CPU operating status (CPU active / idle). This diagram explains the problem (2) of observation using conventional technology using CPU operating status (CPU active / idle).
[0027] Hereinafter, with reference to the drawings, a description will be given of a configuration for carrying out the present invention (hereinafter referred to as "this embodiment"), including a arithmetic unit idle time measuring device, etc.
[0028] (Explanation of Principle) First, the basic principle of the present invention will be explained. The present invention does not asynchronously access the CPU core on which the application being observed is running, or receive information from events caused by a specific process. Instead, it obtains information such as task assignment to the relevant core from the task management functions of the OS or application, and derives the active / idle time progression of the CPU core based on that information. This minimizes the overhead of obtaining timestamps and allows obtaining the actual active / idle time progression of the arithmetic unit due to the application's calculations without modifying the application.
[0029] Figure 1 is a diagram illustrating the basic principles of the present invention. Components identical to those in Figure 48 are denoted by the same reference numerals. The server 1000 shown in Figure 1 comprises hardware 10, an OS 20, a user space 30, and a arithmetic unit idle time measurement device 100. The server 1000 may also be referred to as the arithmetic unit idle time measurement system. The OS 20 has a task management unit 21. The task management unit 21 determines which CPUidle state (C-state) the CPU enters when idle. The user space 30 has an application A31 that is the target of operation analysis.
[0030] The arithmetic unit idle time measuring device 100 measures the active time during processing and the idle time during processing pauses in the arithmetic unit that is executing the application's calculation processing.
[0031] The arithmetic unit idle time measurement device 100 acquires the minimum necessary information from the task management unit 21 to reproduce the time progression, without affecting the active / idle status. More specifically, the arithmetic unit idle time measurement device 100 acquires task management information, including task execution time information, from the task management unit 21, derives the time transition of the processing / pause state of the arithmetic unit based on the task execution time information, and outputs the active / idle status of the arithmetic unit by the application to a file / screen.
[0032] Figure 2 shows the time progression of CPU operation. The upper part of Figure 2 shows the CPU operation by an application (when not observed), and the lower part of Figure 2 shows an example of the derivation of the time progression of CPU operation in the present invention. For the CPU operation shown in the upper part of Figure 2 (when not observed), the minimum information necessary to reproduce the time progression is obtained from the task management unit 21, as indicated by the symbol z (thick solid line on the CPU operation active) in the lower part of Figure 2.
[0033] The arithmetic unit idle time measuring device 100 does not asynchronously access the CPU core on which the application being observed is running, nor does it receive information from events caused by a specific process. Instead, it obtains information such as task assignments to the relevant core from the OS or the application's task management unit 21, and derives the active / idle time progression of the CPU core based on this information.
[0034] As a result, the arithmetic unit idle time measuring device 100 can obtain the original active / idle time progression of the arithmetic unit due to the application's calculations, while minimizing the overhead caused by acquiring timestamps and without modifying the application.
[0035] Embodiments of the present invention based on the above basic concept will now be described. (First Embodiment) [Overall Configuration] Figure 3 is a schematic diagram of a arithmetic unit idle time measurement system equipped with an arithmetic unit idle time measurement device according to the first embodiment of the present invention. The same reference numerals are used for components identical to those in Figure 1. As shown in Figure 3, the arithmetic unit idle time measurement system 1000 includes hardware (HW) 10, an OS 20, and a user space 30, and the arithmetic unit idle time measurement device 100 is provided on the OS 20 and the user space 30.
[0036] <Hardware 10> Hardware 10 includes a CPU 11 having multiple CPU cores #m, CPU core #l, ... In addition to the CPU 11, it may also include accelerators such as a GPU (Graphic Processing Unit), FPGA (Field Programmable Gate Array), ASIC (Application Specific Integrated Circuit), and DPU (Data Processing Unit).
[0037] <OS20> The OS20 comprises a task management unit 21, a arithmetic unit power saving function management unit 24, and a task execution time information acquisition unit 110 (described later) which constitutes the arithmetic unit idle time measurement device 100. The task management unit 21 comprises a task assignment unit 22 and an arithmetic unit pause instruction issuance unit 23. The task management unit 21 and the arithmetic unit power saving function management unit 24 are functional units based on existing technology. Note that the OS functional unit 21A and SystemCall Interface 25 shown in Figure 48 are not installed.
[0038] First, let's explain the functional parts related to existing technology. We will take the example where the arithmetic unit is a CPU and the OS is Linux ("Linux" is a registered trademark). The task management unit 21 is a task scheduler that has task management information including task execution time information.
[0039] The task assignment unit 22 assigns tasks (threads) of application A31 to CPU cores #m, #l, ... of hardware 10.
[0040] The arithmetic unit suspend instruction issuer 23 is an existing function within the OS and is a mechanism that is called when there are no other tasks to execute. The arithmetic unit suspend instruction (CPU suspend instruction) issuer 23 issues a CPU suspend instruction by specifying the CPU idle state (C-state) designated by the arithmetic unit power saving function management unit (CPU idle management unit) 24. The arithmetic unit suspend instruction issuer 23 is called a swapper process in the Linux kernel. The arithmetic unit suspend instruction issuer 23 is a process that is started when there are no other tasks to start on the core in question, and MWAIT (CPU suspend instruction) is issued within the swapper process.
[0041] The arithmetic unit power saving function management unit (CPU idle management unit) 24 is an existing function within the OS and is a mechanism that determines which CPU idle state (C-state) the CPU enters when idle. The arithmetic unit power saving function management unit (CPU idle management unit) 24 is called by the task scheduler (task management unit 21) immediately before issuing a CPU suspend instruction in order to determine which CPU idle state (C-state) the CPU enters.
[0042] <User Space 30> The user space 30 includes application A31, which is the target of the operation analysis, and a arithmetic unit operation status derivation unit 120 (described later) which constitutes the arithmetic unit idle time measurement device 100. Note that dynamic analysis tools 32 such as perf shown in Figure 48 are not installed.
[0043] [Calculator Idle Time Measurement Device] As shown in the dashed box in Figure 3, the calculator idle time measurement device 100 includes a task execution time information acquisition unit 110 on the OS 20 and a calculator operation status derivation unit 120 on the user space 30.
[0044] <Task Execution Time Information Acquisition Unit 110> The task execution time information acquisition unit 110 acquires task management information including task execution time information from a task management unit 21 that performs task management for allocating tasks to an arithmetic unit. The task execution time information acquisition unit 110 acquires task execution time information from the task management unit 21 for deriving the active / idle information of each CPU core. The task execution time information acquisition unit 110 acquires time information immediately before and immediately after the issuance of a CPU suspension instruction from an arithmetic unit suspension instruction issuance unit 23 of the task management unit 21.
[0045] An example of the acquisition method is as follows. - The task execution time information acquisition unit 110 hooks a timestamp acquisition function to the arithmetic unit suspension instruction issuance unit 23 of the task management unit 21, and uses the hook to acquire timestamps at the time of issuance of the suspension instruction (in this embodiment, immediately before issuance) and at the time of return from the suspension instruction (in this embodiment, immediately after return). That is, a hook (here, a timestamp acquisition function is hooked) for adding unique processing to a specific location in the program is added to the arithmetic unit suspension instruction issuance unit 23, and the task execution time information acquisition unit 110 acquires the timestamp acquisition function using the hook.
[0046] - The task execution time information acquisition unit 110 hooks a timestamp acquisition function to the task allocation unit 22 of the task management unit 21, and acquires timestamps when a task is completed and when a task is scheduled (the third embodiment described later).
[0047] <Arithmetic Unit Operation Status Derivation Unit 120> The arithmetic unit operation status derivation unit 120 derives active or idle information of each arithmetic unit by the application based on the acquired task execution time information. The arithmetic unit operation status derivation unit 120 derives and outputs active / idle information of each arithmetic unit by the application from the task execution time information. An example of the derivation method is as follows. - Based on the timestamps immediately before and immediately after the issuance of the arithmetic unit suspension instruction, the period from immediately before issuance to immediately after return is output as an idle period, and the other periods are output as active periods.
[0048] The output examples are as follows: ・Output the time transition of active / idle to the screen ・Output the time transition of active / idle to a file
[0049] [Example 1] Example 1 of the arithmetic unit idle time measurement device 100 according to the first embodiment will be described. The arithmetic unit idle time measurement device 100 of Example 1 acquires the timestamps immediately before the issuance of the arithmetic unit halt instruction and immediately after the return from the halt instruction as information, and derives and outputs active / idle information based on this.
[0050] FIG. 4 is a configuration diagram showing an operation image of the arithmetic unit idle time measurement device 100 shown in FIG. 3. The same components as those in FIG. 3 are denoted by the same reference numerals. The arithmetic unit idle time measurement device 100 shown in FIG. 4 includes a task execution time information acquisition unit 110, an arithmetic unit operation status derivation unit 120, and a shared memory 130. The shared memory 130 is installed between the OS 20 and the user space 30.
[0051] The task execution time information acquisition unit 110 shown in FIG. 4 acquires a timestamp on the corresponding core immediately before the arithmetic unit halt instruction is issued and arranges the information shown in FIG. 5 in the shared memory 130. Also, the task execution time information acquisition unit 110 acquires a timestamp on the corresponding core immediately after returning from the arithmetic unit halt instruction and arranges it in the shared memory 130.
[0052] FIG. 5 is a diagram showing an example of the information arranged in the shared memory 130. The shared memory 130 shown in FIG. 5 stores [active: 1 / idle: 0, timestamp (microseconds)].
[0053] As described above, in the shared memory 130, "timestamp" and information on "immediately before the issuance of the halt instruction or immediately after the return" are arranged.
[0054] The arithmetic unit operation status derivation unit 120 shown in Figure 4 outputs the active / idle time progression based on information stored in the shared memory 130. The arithmetic unit operation status derivation unit 120 outputs the active / idle time progression as text (output example 1) or on the screen (output example 2). The arithmetic unit idle time measurement device 100 can be used as a tool to investigate the power consumption of existing systems and the causes of increased power consumption. Therefore, the screen output examples are important from a visualization perspective.
[0055] Figure 6 shows an example of outputting the time progression of active / idle based on information stored in the shared memory 130. As shown in Figure 6, the information shown in Figure 5 is visualized and displayed. For example, the screen displays the Idle state from timestamp[2827559] to [2828660] (microseconds) (thick solid line in Figure 6), the Active state from the following timestamp[2828660] to [3361923] (microseconds) (thick solid line in Figure 6), and then the Idle state again from timestamp[3361923] to [3370088] (thick solid line in Figure 6). In addition to the screen display as shown in Figure 6, screen output also includes printing and data distribution.
[0056] [Implementation Example] An implementation example of Example 1 will be described. As an implementation example, we will take the case where eBPF, a function of Linux (registered trademark), is used.
[0057] Figure 7 is a configuration diagram showing an implementation example of the arithmetic unit idle time measurement device 100 shown in Figure 4, using eBPF, a function of Linux. The same reference numerals are used for the same components as in Figure 4. The arithmetic unit idle time measurement device 100 shown in Figure 7 comprises a task execution time information acquisition unit 110, an arithmetic unit operation status derivation unit 120, and a shared memory 130.
[0058] The task execution time information acquisition unit 110 is an eBPF program loaded into the OS kernel. The task execution time information acquisition unit 110 hooks the eBPF program to run at the timing when the CPU idle instruction issuance function CPUidle() is called (immediately before the idle instruction is issued). When this eBPF program starts, it acquires a timestamp and places the information [active or idle, timestamp] into the eBPF map.
[0059] The shared memory 130 stores the eBPF map. The arithmetic unit operation status derivation unit 120 is a user program that performs the following roles: - Loads the eBPF program into the OS kernel. - Obtains information placed in the eBPF map. - Derives the screen output shown in Figure 6 from the obtained information.
[0060] The operation of the arithmetic unit idle time measurement device 100, configured as described above, will be explained below. <Operation of the task execution time information acquisition unit 110> First, the operation of the task execution time information acquisition unit 110 of the arithmetic unit idle time measurement device 100 shown in Figure 4 will be explained. Figure 8 is a configuration diagram showing the operation image of the task execution time information acquisition unit 110. The same reference numerals are used for the same components as in Figure 4. In addition, the relevant functional units are represented by thick solid lines, and functional units that are not related to the operation are represented by dashed lines. As shown in Figure 8, the task execution time information acquisition unit 110 hooks a timestamp acquisition function to the arithmetic unit pause instruction issuing unit 23 and acquires timestamps immediately before the issuance of the pause instruction and immediately after the recovery from the pause instruction (dashed arrows in Figure 8 pointing from the arithmetic unit pause instruction issuing unit 23 to the task execution time information acquisition unit 110).
[0061] The task execution time information acquisition unit 110, after being loaded into the OS kernel as an eBPF program or the like, performs the following operations.
[0062] In addition to the timestamp, it is necessary to determine whether the timestamp was obtained "immediately before the CPU pause instruction was issued" or "immediately after the CPU pause instruction was resumed." For this reason, a flowchart is executed every time, immediately before the CPU pause instruction is issued, and another flowchart is executed every time, immediately after the CPU pause instruction is resumed.
[0063] Figures 9A and 9B are flowcharts showing the operation of the task execution time information acquisition unit 110. Figure 9A is a flowchart that is activated every time immediately before issuing a CPU pause instruction. In Figure 9A, in step S11, the task execution time information acquisition unit 110 acquires a timestamp. In step S12, the task execution time information acquisition unit 110 creates an entry for [idle, timestamp], adds it to the shared memory 130, and terminates the processing of this flow.
[0064] Figure 9B is a flowchart that is activated every time immediately after resuming from a CPU pause instruction. In Figure 9B, in step S21, the task execution time information acquisition unit 110 acquires a timestamp. In step S22, the task execution time information acquisition unit 110 creates an entry for [active, timestamp], adds it to the shared memory 130, and terminates the processing of this flow.
[0065] Next, we will discuss the active / idle descriptors. It is necessary to determine whether the timestamp was obtained "immediately before the CPU pause instruction was issued" or "immediately after the CPU pause instruction was resumed," but the format does not matter as long as it is uniquely determined between the arithmetic unit operation status derivation unit 120 and the system. For example, the following format is possible.
[0066] (Example 1) Specify in the form active:1, idle:0. Example entry immediately before issuing a pause instruction: [0, 13256219] Example entry immediately after resuming from a pause instruction: [1, 13367847] The format in (Example 1) requires only 1 bit of information, resulting in the fastest operation and lowest memory consumption.
[0067] (Example 2) The entries are stored as strings "active" and "idle". Example of an entry immediately before issuing a pause instruction: ["active", 13256219] Example of an entry immediately after resuming from a pause instruction: ["idle", 13367847] Although the format of (Example 2) is less efficient than the format of (Example 1), it improves the readability of the program. In addition, the format of (Example 2) allows the arithmetic unit operation status derivation unit 120 to output an output that the user can understand even if the entry is not processed, thus reducing the computational load on the arithmetic unit operation status derivation unit 120.
[0068] <Operation of the arithmetic unit operation status derivation unit 120> Next, the operation of the arithmetic unit operation status derivation unit 120 of the arithmetic unit idle time measuring device 100 shown in Figure 4 will be explained. Figure 10 is a configuration diagram showing the operation image of the arithmetic unit operation status derivation unit 120. The same reference numerals are used for the same components as in Figures 3 and 4. In addition, the relevant functional units are represented by thick solid lines, and functional units that are not related to operation are represented by dashed lines. The arithmetic unit operation status derivation unit 120 shown in Figure 10 outputs the active / idle time progression based on the information stored in the shared memory 130.
[0069] Figure 11 is a flowchart showing the operation of the arithmetic unit operation status derivation unit 120 as shown in Figure 10. In step S31, the arithmetic unit operation status derivation unit 120 refers to the shared memory 130. In step S32, the arithmetic unit operation status derivation unit 120 determines whether or not a new entry has been added.
[0070] If no new entries have been added (S32: No), in step S33 the arithmetic unit operation status derivation unit 120 determines whether or not the shared memory reference interval has been specified by the user.
[0071] This section describes how to specify the shared memory access interval. Examples of specification methods: • The user can specify the access interval as a command-line argument at startup (e.g., 1 msec). • The access interval can be permanently written into the program.
[0072] Here, specifying no reference interval or a high-frequency reference interval reduces the risk of entries overflowing even with a small shared memory, and stable operation can be expected. On the other hand, the arithmetic unit operation status derivation unit 120 performs references busily, thus consuming a lot of computing resources. Conversely, specifying a low-frequency reference interval reduces the amount of computing resources used by the arithmetic unit operation status derivation unit 120, but increases the risk of entries overflowing, so this is limited to cases where entries are added only infrequently (or the memory capacity of the shared memory 130 needs to be increased).
[0073] Returning to the flow in Figure 11, if the shared memory reference interval is specified by the user (S33: Yes), in step S34 the arithmetic unit operation status derivation unit 120 sleeps for the specified reference interval and returns to step S31. If the shared memory reference interval is not specified by the user (S33: No), it returns directly to step S31.
[0074] If a new entry has been added in step S32 (S32: Yes), in step S35 the arithmetic unit operation status derivation unit 120 retrieves an entry for [active / idle, timestamp] from the shared memory 130. The entries are described in (Example 1) and (Example 2) above.
[0075] In step S36, the arithmetic unit operation status derivation unit 120 determines whether or not there is a specification to perform sequential output.
[0076] This section describes sequential output and termination output. The user specifies whether to use sequential output or termination output at startup. <Sequential Output> - Output is added to the screen or file each time an entry is retrieved from shared memory 130. <Termination Output> - Information retrieved from shared memory 130 is temporarily held and output at termination.
[0077] Returning to the flow in Figure 11, if there is a specification to perform sequential output (S36: Yes), in step S37 the arithmetic unit operation status derivation unit 120 outputs the active / idle status to the screen or file and proceeds to step S39. If there is no specification to perform sequential output (S36: No), in step S38 the arithmetic unit operation status derivation unit 120 temporarily holds the contents of the acquired entries in memory / storage (not shown) and proceeds to step S39.
[0078] In step S39, the arithmetic unit operation status derivation unit 120 determines whether or not the termination condition is met. If the termination condition is not met (S39: No), the process returns to step S31.
[0079] Examples of termination conditions are as follows: • The user specifies the termination time at startup (e.g., terminate after 10 seconds) • The user specifies the number of termination entries at startup (e.g., terminate after 10,000 entries) • The system receives a termination command from the user (e.g., receives a signal)
[0080] If the termination condition is met (S39: Yes), in step S40 the arithmetic unit operation status derivation unit 120 determines whether or not there is a specification to execute sequential output. If there is a specification to execute sequential output (S40: Yes), the processing of this flow is terminated.
[0081] If there is no specification to perform sequential output (S40: No), in step S41 the arithmetic unit operation status derivation unit 120 outputs the active / idle status to the screen or file and terminates the processing of this flow.
[0082] [Output Examples] As mentioned above, the output examples on the screen are important from a visualization standpoint for the arithmetic unit idle time measuring device 100. Screen output examples will be explained with reference to Figures 12 to 17. Figures 12 to 14 are screen output examples, and Figures 15 to 17 are text output examples.
[0083] 《Example of correspondence between acquired information and output (output at termination)》 Figure 12 is a diagram showing an example of the correspondence between acquired information and output (output at termination). The left diagram of Figure 12 is an example of information temporarily held in memory / storage (not shown) at termination. Here, memory / storage refers to the memory that the arithmetic unit operation status derivation unit 120 (Figure 10) acquires from the shared memory 130 (Figure 10) and temporarily holds.
[0084] The arithmetic unit operation status derivation unit 120 shown in Figure 10 outputs the active / idle time progression based on the information in the left diagram of Figure 12 (arrow and symbol a in Figure 12). The right diagram of Figure 12 is the screen output of the information in the left diagram of Figure 12 by the arithmetic unit operation status derivation unit 120. The screen output is as follows: • Output to screen files such as .png or .jpg • Screen output (right diagram of Figure 12)
[0085] As shown in the right diagram of Figure 12, the information shown in the left diagram of Figure 12 is visualized and displayed. For example, the screen displays the following states: from timestamp[2827559] (microseconds) to [3128660], the Idle state (thick solid line in the right diagram of Figure 12); from the following timestamp[3128660] to [3361923], the Active state (thick solid line in the right diagram of Figure 12); and then from timestamp[3361923] to [3570088], the Idle state again (thick solid line in the right diagram of Figure 12).
[0086] 《Examples of correspondence between acquired information and output (sequential output)》 Figures 13A-13C show examples of correspondence between information acquired at times T, T+1, and T+2 and the output (sequential output). Figure 13A left shows an example of information acquired by the arithmetic unit operation status derivation unit 120 from the shared memory 130 at a certain time T. The arithmetic unit operation status derivation unit 120 shown in Figure 10 outputs the time progression of active / idle based on the information [0, 2827559] in Figure 13A left (arrow and symbol b in Figure 13A left). Figure 13A right shows the screen output at time T. Neither the Idle state nor the Active state is displayed on the screen in Figure 13A right.
[0087] Figure 13B (left) shows an example of information acquired by the arithmetic unit operation status derivation unit 120 from the shared memory 130 at a certain time T+1. The arithmetic unit operation status derivation unit 120 shown in Figure 10 outputs the active / idle time progression based on the information [1, 3128660] in Figure 13B (left) (arrow and symbol c in Figure 13B). Figure 13B (right) shows the screen output at time T+1. In Figure 13B (right), the idle state (thick solid line in Figure 13B (right)) is displayed on the screen from timestamp [2827559] to [3128660].
[0088] The left diagram of Figure 13C shows an example of information acquired by the arithmetic unit operation status derivation unit 120 from the shared memory 130 at a certain time T+2. The arithmetic unit operation status derivation unit 120 shown in Figure 10 outputs the time progression of active / idle based on the information [0, 3361923] in the left diagram of Figure 13C (arrow and symbol d in the left diagram of Figure 13C). The right diagram of Figure 13C shows the screen output at time T+2. The right diagram of Figure 13C displays the active state (thick solid line in the right diagram of Figure 13C) from timestamp [3128660] to [3361923], after the idle state (thick solid line in the right diagram of Figure 13C) from timestamp [2827559] to [3128660].
[0089] 《Example of output when the application N being measured has multiple processes》 Figure 14 shows an example of the output when the application N being measured has multiple processes and operates using multiple cores #m #l #k. The application N being measured is not shown, but it is a replacement for application A31 in Figure 10. The multiple cores #m #l #k correspond to the multiple CPU cores #m, CPU core #l, ... of CPU 11 in Figure 10.
[0090] The upper part of Figure 14 shows a screen display indicating the usage of core #m by application N, the middle part of Figure 14 shows a screen display indicating the usage of core #l by application N, and the lower part of Figure 14 shows a screen display indicating the usage of core #k by application N. As shown in Figure 14, by aligning the timestamps immediately before the issuance of the arithmetic unit pause instruction and immediately after the resumption from the pause instruction on the time axis, the usage of each CPU core by application N can be compared and understood.
[0091] The above describes examples of screen output with reference to Figures 12 to 14. Next, we will describe examples of text output with reference to Figures 15 to 17. The source information (information obtained by the arithmetic unit operation status derivation unit 120 from the shared memory 130) is the same for the screen output examples in Figures 12 to 14 and the text output examples in Figures 15 to 17; only the output format differs.
[0092] Specifically, the information in the left diagrams of Figures 12 to 13A-13C is identical to the information in the left diagrams of Figures 15 to 16A-16C. Furthermore, the information that forms the basis of the screen output in Figure 14 is identical to the information that forms the basis of the text output in Figure 17. The screen output example in the right diagram of Figure 12 is shown in the right diagram of Figure 15 as the text output example (the arrow and symbol e in the left diagram of Figure 15C).
[0093] The screen output example in the right-hand figure of Figures 13A-13C is shown in the text output example in the right-hand figure of Figures 16A-16C (arrows and symbols f, g, h in the left-hand figures of Figures 16A-16C). The output example in Figure 14 is shown in the text output example in Figure 17. The information that forms the basis of the text output is the same.
[0094] While text output is less visually appealing than image output, it has the advantage of shorter output times and smaller file sizes because it outputs the information with minimal processing. It also facilitates secondary processing such as image conversion and statistical analysis.
[0095] (Second Embodiment) Figure 18 is a schematic diagram of a arithmetic unit idle time measurement system equipped with an arithmetic unit idle time measurement device according to a second embodiment of the present invention. The same reference numerals are used for the same components as in Figure 3. As shown in Figure 18, the arithmetic unit idle time measurement system 1000A includes hardware 10, an OS 20, and a user space 30, and the arithmetic unit idle time measurement device 100A is provided on the OS 20 and the user space 30.
[0096] As shown in the dashed box in Figure 18, the arithmetic unit idle time measurement device 100A is equipped with a task execution time information acquisition unit 110 and an arithmetic unit power saving function information acquisition unit 140 on the OS 20, and an arithmetic unit operation status derivation unit 120 on the user space 30. In other words, the arithmetic unit idle time measurement device 100A is the arithmetic unit idle time measurement device 100 in Figure 3 with the addition of the arithmetic unit power saving function information acquisition unit 140.
[0097] The arithmetic unit power saving function information acquisition unit 140 acquires arithmetic unit power saving function information from the arithmetic unit power saving function management unit 24, which manages the power saving function of the arithmetic unit. The arithmetic unit power saving function information is information that indicates which CPUidle state (C-state) the CPU enters when idle. When a pause instruction is issued, the arithmetic unit power saving function information acquisition unit 140 acquires the arithmetic unit power saving function information from the arithmetic unit pause instruction issuance unit 23 of the task management unit 21, along with a timestamp.
[0098] The arithmetic unit operation status derivation unit 120 derives the power saving function status during idle time based on the power saving function information of the arithmetic unit acquired by the power saving function information acquisition unit 140, and presents it together with the progression of the active / idle time of the arithmetic unit.
[0099] [Example 2] Example 2 of the arithmetic unit idle time measuring device 100A according to the second embodiment will be described. The arithmetic unit idle time measuring device 100A of Example 2 acquires timestamps immediately before the issuance of a CPU pause instruction and immediately after the recovery from a CPU recovery instruction, and acquires arithmetic unit power saving function information regarding the use of the CPU power saving function, and derives and outputs active / idle information based on the arithmetic unit power saving function information.
[0100] Figure 19 is a configuration diagram showing the operation image of the arithmetic unit idle time measurement device 100 shown in Figure 18. The same reference numerals are used for the same components as in Figure 18. The arithmetic unit idle time measurement device 100A shown in Figure 19 comprises a task execution time information acquisition unit 110, an arithmetic unit power saving function information acquisition unit 140, an arithmetic unit operation status derivation unit 120, and a shared memory 130. The shared memory 130 is installed between the OS 20 and the user space 30.
[0101] The task execution time information acquisition unit 110 shown in Figure 19 acquires a timestamp on the relevant core immediately before a arithmetic unit pause instruction is issued and places the information shown in Figure 20 into the shared memory 130. Furthermore, the task execution time information acquisition unit 110 acquires a timestamp on the relevant core immediately after resuming from the arithmetic unit pause instruction and places it into the shared memory 130.
[0102] The arithmetic unit power saving function information acquisition unit 140 acquires arithmetic unit power saving function information from the arithmetic unit pause instruction issuance unit 23 along with a timestamp when a pause instruction is issued, and passes it to the task execution time information acquisition unit 110, or places it directly in the shared memory 130.
[0103] Figure 20 shows an example of information placed in the shared memory 130. The information placed in the shared memory 130 in Figure 5 has the "idle power saving function (C-state) status" added to it. The shared memory 130 shown in Figure 20 stores [active:1 / idle:0, timestamp (microseconds), idle power saving function (C-state) status].
[0104] As described above, the shared memory 130 contains information such as "timestamp," "whether it is immediately before or immediately after the suspension command is issued," and "the power saving function status when idle."
[0105] [Implementation Example] An implementation example of Example 2 will be described. As an implementation example, we will take the case where eBPF, a Linux feature, is used.
[0106] Figure 21 is a configuration diagram showing an implementation example of the arithmetic unit idle time measurement device 100A shown in Figure 19, using eBPF, a Linux function. The same reference numerals are used for components identical to those in Figure 19. The arithmetic unit idle time measurement device 100A shown in Figure 21 comprises a task execution time information acquisition unit 110, an arithmetic unit operation status derivation unit 120, a shared memory 130, and an arithmetic unit power saving function information acquisition unit 140.
[0107] The arithmetic unit power saving function information acquisition unit 140 is an eBPF program that operates after schedule(), just like the task execution time information acquisition unit 110. The eBPF program can be called as a function from the task execution time information acquisition unit 110. This function obtains information on which power saving function state (such as C-state) is about to be entered by referring to the arguments of the arithmetic unit pause instruction issuer 23, and passes this information to the task execution time information acquisition unit 110.
[0108] The task execution time information acquisition unit 110 is an eBPF program loaded into the OS kernel. The task execution time information acquisition unit 110 hooks the eBPF program to run when the CPU idle instruction issuance function CPUidle() is called. When this eBPF program starts, it acquires a timestamp. The eBPF program also calls the arithmetic unit power saving function information acquisition unit 140 to acquire arithmetic unit power saving function information (such as C-state). After that, the eBPF program places the information [active or idle, timestamp, C-state] into the eBPF map.
[0109] The shared memory 130 stores the eBPF map. The arithmetic unit operation status derivation unit 120 is a user program that performs the following roles: - Loads the eBPF program into the OS kernel. - Obtains information placed in the eBPF map. - Executes the output shown in Figures 12 to 17 based on the obtained information.
[0110] The operation of the arithmetic unit idle time measurement device 100A, configured as described above, will be explained below. <Operation of the task execution time information acquisition unit 110> First, the operation of the task execution time information acquisition unit 110 of the arithmetic unit idle time measurement device 100A shown in Figure 21 will be explained. Figure 22 is a configuration diagram showing the operation image of the task execution time information acquisition unit 110. The same reference numerals are used for the same components as in Figure 21. In addition, the relevant functional units are represented by thick solid lines, and functional units that are not related to the operation are represented by dashed lines. As shown in Figure 22, the task execution time information acquisition unit 110 hooks a timestamp acquisition function to the arithmetic unit pause instruction issuing unit 23 and acquires timestamps immediately before the issuance of the pause instruction and immediately after the recovery from the pause instruction (dashed arrows in Figure 22 pointing from the arithmetic unit pause instruction issuing unit 23 to the task execution time information acquisition unit 110).
[0111] The task execution time information acquisition unit 110, after being loaded into the OS kernel as an eBPF program or the like, performs the following operations.
[0112] In addition to the timestamp, it is necessary to determine whether the timestamp was obtained "immediately before the CPU pause instruction was issued" or "immediately after the CPU pause instruction was resumed." For this reason, a flowchart is executed every time, immediately before the CPU pause instruction is issued, and another flowchart is executed every time, immediately after the CPU pause instruction is resumed.
[0113] Figures 23A and 23B are flowcharts showing the operation of the task execution time information acquisition unit 110. Figure 23A is a flowchart that is activated every time immediately before issuing a CPU pause instruction. In Figure 23A, in step S51, the task execution time information acquisition unit 110 acquires a timestamp. In step S52, the task execution time information acquisition unit 110 calls the arithmetic unit power saving function information acquisition unit 140 and acquires arithmetic unit power saving function information (such as C-state) from the information of the arithmetic unit pause instruction. In step S53, the task execution time information acquisition unit 110 creates an entry for [idle, timestamp, C-state], adds it to the shared memory 130, and terminates the processing of this flow.
[0114] Regarding C-state, a CPU power saving function, there are two methods for saving the arguments of the pause instruction: one that saves them as they are, and another that saves them after converting them to the meaning of the arguments. For example, there is the following saving method: (Example 1) Save as is. [1, 2827559, 3] # The argument is 3
[0115] (Example 2) Convert to meaning and save. [1, 2827559, “C6”] # The state of argument 3 is “C6” is stored within the eBPF program, and when creating an entry, it is converted to a string and then placed.
[0116] Figure 23B is a flowchart that is launched every time immediately after resuming from a CPU pause instruction. In Figure 23B, in step S61, the task execution time information acquisition unit 110 acquires a timestamp. In step S62, the task execution time information acquisition unit 110 creates an entry for [active or idle, timestamp, C-state], adds it to the shared memory 130, and terminates the processing of this flow. When active, information regarding the C-state is not necessary, so it is sufficient to define information that can identify it from the user program (for example, 0, -1, etc.).
[0117] <Operation of the arithmetic unit operation status derivation unit 120> Next, the operation of the arithmetic unit operation status derivation unit 120 of the arithmetic unit idle time measuring device 100A shown in Figure 21 will be explained. Figure 24 is a configuration diagram showing the operation image of the arithmetic unit operation status derivation unit 120. The same reference numerals are used for the same components as in Figure 21. In addition, the relevant functional units are represented by thick solid lines, and functional units that are not related to operation are represented by dashed lines. The arithmetic unit operation status derivation unit 120 shown in Figure 24 outputs the active / idle time progression based on the information stored in the shared memory 130.
[0118] Figure 25 is a flowchart showing the operation of the arithmetic unit operation status derivation unit 120 shown in Figure 24. In step S71, the arithmetic unit operation status derivation unit 120 refers to the shared memory 130. In step S72, the arithmetic unit operation status derivation unit 120 determines whether a new entry has been added.
[0119] If no new entries have been added (S72: No), in step S73 the arithmetic unit operation status derivation unit 120 determines whether or not the shared memory reference interval has been specified by the user.
[0120] This section describes how to specify the shared memory access interval. Examples of specification methods: • The user can specify the access interval as a command-line argument at startup (e.g., 1 msec). • The access interval can be permanently written into the program.
[0121] Here, specifying no reference interval or a high-frequency reference interval reduces the risk of entries overflowing even with a small shared memory, and stable operation can be expected. On the other hand, the arithmetic unit operation status derivation unit 120 performs references busily, increasing power consumption. Conversely, specifying a low-frequency reference interval reduces the increase in power consumption by the arithmetic unit operation status derivation unit 120, but increases the risk of entries overflowing, so this is limited to cases where entries are added only infrequently (or the memory capacity of the shared memory 130 needs to be increased).
[0122] Returning to the flow in Figure 25, if the shared memory reference interval is specified by the user (S73: Yes), in step S74 the arithmetic unit operation status derivation unit 120 sleeps for the specified reference interval and returns to step S71. If the shared memory reference interval is not specified by the user (S73: No), it returns directly to step S71.
[0123] If a new entry has been added in step S72 (S72: Yes), in step S75 the arithmetic unit operation status derivation unit 120 obtains an entry for [active / idle, timestamp, C-state] from the shared memory 130.
[0124] In step S76, the arithmetic unit operation status derivation unit 120 determines whether or not there is a specification to perform sequential output.
[0125] This section describes sequential output and termination output. The user specifies whether to use sequential output or termination output at startup. <Sequential Output> - Output is added to the screen or file each time an entry is retrieved from shared memory 130. <Termination Output> - Information retrieved from shared memory 130 is temporarily held and output at termination.
[0126] Returning to the flow in Figure 25, if there is a specification to perform sequential output (S76: Yes), in step S77 the arithmetic unit operation status derivation unit 120 outputs the active / idle status to the screen or file and proceeds to step S79. If there is no specification to perform sequential output (S76: No), in step S78 the arithmetic unit operation status derivation unit 120 temporarily holds the contents of the acquired entries in memory / storage (not shown) and proceeds to step S79.
[0127] In step S79, the arithmetic unit operation status derivation unit 120 determines whether or not the termination condition is met. If the termination condition is not met (S79: No), the process returns to step S71.
[0128] Examples of termination conditions are as follows: • The user specifies the termination time at startup (e.g., terminate after 10 seconds) • The user specifies the number of termination entries at startup (e.g., terminate after 10,000 entries) • The system receives a termination command from the user (e.g., receives a signal)
[0129] If the termination condition is met (S79: Yes), in step S80 the arithmetic unit operation status derivation unit 120 determines whether or not there is a specification to execute sequential output. If there is a specification to execute sequential output (S80: Yes), the processing of this flow is terminated.
[0130] If there is no specification to perform sequential output (S80: No), in step S81 the arithmetic unit operation status derivation unit 120 outputs the active / idle status to the screen or file and terminates the processing of this flow.
[0131] [Output Examples] As mentioned above, the output examples on the screen are important from a visualization standpoint for the arithmetic unit idle time measuring device 100A. Screen output examples will be explained with reference to Figures 26 to 30C. Figures 26 to 28 are screen output examples, and Figures 29 to 30C are text output examples.
[0132] 《Example of correspondence between acquired information and output (output at termination)》 Figure 26 is a diagram showing an example of the correspondence between acquired information and output (output at termination). The left diagram of Figure 26 is an example of the following information that is temporarily held in memory / storage at termination: ・[active:1 / idle:0, timestamp (microseconds), power saving function (C-state) status during idle] … [0, 2827559, 3] [1, 3128660, 0] [0, 3361923, 1] [1, 3570088, 0] … is saved.
[0133] The arithmetic unit operation status derivation unit 120 shown in Figure 24 outputs the active / idle time progression based on the information in the left diagram of Figure 26 (arrow and symbol i in Figure 26). The right diagram of Figure 26 is the screen output of the information in the left diagram of Figure 26 by the arithmetic unit operation status derivation unit 120. The screen output is as follows: • Output to screen files such as .png or .jpg • Screen output (right diagram of Figure 26)
[0134] As shown in the right diagram of Figure 26, the information shown in the left diagram of Figure 26 is visualized and displayed. For example, from timestamp [2827559] (microseconds) to [3128660], the Idle (state 3) state (thick solid line in the right diagram of Figure 26) is displayed; from the following timestamp [3128660] to [3361923], the Active state (thick solid line in the right diagram of Figure 26) is displayed; and then from timestamp [3361923] to [3570088], the Idle (state 1) state (thick solid line in the right diagram of Figure 26) is displayed. As can be seen by comparing the right diagram of Figure 26 with the right diagram of Figure 12, in the second embodiment, the power saving function (C-state) state during idle is also displayed along with the time transition of the active / idle state of the arithmetic unit.
[0135] 《Examples of correspondence between acquired information and output (sequential output)》 Figures 27A-27C show examples of correspondence between information acquired at times T, T+1, and T+2 and the output (sequential output). Figure 27A left shows an example of information acquired by the arithmetic unit operation status derivation unit 120 from the shared memory 130 at a certain time T. The arithmetic unit operation status derivation unit 120 shown in Figure 24 outputs the time progression of active / idle based on the information [0, 2827559, 3] in Figure 27A left (arrow and symbol j in Figure 27A left). Figure 27A right shows the screen output at time T. Neither the Idle state nor the Active state is displayed on the screen in Figure 27A right.
[0136] The left diagram of Figure 27B shows an example of information acquired by the arithmetic unit operation status derivation unit 120 from the shared memory 130 at a certain time T+1. The arithmetic unit operation status derivation unit 120, shown in Figure 24, outputs the active / idle time progression based on the information [1, 3128660, 0] in the left diagram of Figure 27B (arrow and symbol k in the left diagram of Figure 27B). The right diagram of Figure 27B shows the screen output at time T+1. In the right diagram of Figure 27B, the Idle (state 3) state (thick solid line in the right diagram of Figure 27B) is displayed on the screen from timestamp [2827559] to [3128660].
[0137] The left diagram of Figure 27C shows an example of information acquired by the arithmetic unit operation status derivation unit 120 from the shared memory 130 at a certain time T+2. The arithmetic unit operation status derivation unit 120, shown in Figure 24, outputs the time progression of active / idle based on the information [0, 3361923, 1] in the left diagram of Figure 27C (arrow and symbol l in the left diagram of Figure 27C). The right diagram of Figure 27C shows the screen output at time T+2. The right diagram of Figure 27C displays the Active state (thick solid line in the right diagram of Figure 27C) from timestamp [3128660] to [3361923], following the Idle (state 3) state (thick solid line in the right diagram of Figure 27C) from timestamp [2827559] to [3128660].
[0138] 《Example of output when the application N being measured has multiple processes》 Figure 28 shows an example of the output when the application N being measured has multiple processes and operates using multiple cores #m and #l. The application N being measured is not shown, but it is a replacement for application A31 in Figure 24. Also, the multiple cores #m and #l correspond to the multiple CPU cores #m, CPU core #l, ... of CPU 11 in Figure 24.
[0139] The upper part of Figure 28 shows a screen display indicating the usage of core #m by application N, and the lower part of Figure 28 shows a screen display indicating the usage of core #l by application N. As shown in the upper part of Figure 28, in the usage of core #m by application N, for example, when the Active state (thick solid line in the upper part of Figure 28) from timestamp[3128660] to [3361923] drops to the Idle state, it can be seen that it is in the Idle(state1) state (thick solid line in the upper part of Figure 28) among the Idle(state1) to Idle(state3) states. Furthermore, it can be seen that the Idle(state1) state and the Active state are repeated.
[0140] On the other hand, as shown in the lower part of Figure 28, the CPU core #l usage by application N shows that after being in the Idle (state 2) state from timestamp [3128660] to [3128710] (thick solid line in the lower part of Figure 28), it transitions to the Active state, and the Active state continues from timestamp [3128710] to [3570128] (thick solid line in the lower part of Figure 28). When the Active state drops to the Idle state, it does not drop to the original Idle (state 2) state, but to a deeper Idle (state 3) state (thick solid line in the lower part of Figure 28).
[0141] Furthermore, as shown in Figure 28, by aligning the timestamps immediately before the issuance of the arithmetic unit pause instruction and immediately after the restoration instruction on the time axis, it is possible to compare and understand the usage status of each CPU core #m and #l by application N.
[0142] The above describes examples of screen output with reference to Figures 26 to 28. Next, examples of text output will be described with reference to Figures 29 to 30C. The source information (information obtained by the arithmetic unit operation status derivation unit 120 from the shared memory 130) is the same for the screen output examples in Figures 26 to 28 and the text output examples in Figures 29 to 30C; only the output format differs.
[0143] Specifically, the information in the left diagrams of Figures 29 to 30A-30C is the same as the information in the left diagrams of Figures 26 to 27A-27C. The screen output example in the right diagram of Figure 26 is shown in the right diagram of Figure 29 as a text output example (arrows and symbols m in the left diagram of Figure 29). The screen output examples in the right diagrams of Figures 27A-27C are shown in the right diagrams of Figures 30A-30C as text output examples (arrows and symbols n, o, p in the left diagrams of Figures 30A-30C).
[0144] (Third Embodiment) Figure 31 is a schematic diagram of a arithmetic unit idle time measurement system equipped with an arithmetic unit idle time measurement device according to the third embodiment of the present invention. The same reference numerals are used for components identical to those in Figure 3. As shown in Figure 31, the arithmetic unit idle time measurement system 1000B includes hardware 10, an OS 20, and a user space 30, and the arithmetic unit idle time measurement device 100B is provided on the OS 20 and the user space 30.
[0145] The arithmetic unit idle time measuring device 100B comprises a task execution time information acquisition unit 110B, an arithmetic unit operation status derivation unit 120B, and a shared memory 130. The shared memory 130 is installed between the OS 20 and the user space 30. The arithmetic unit idle time measuring device 100B calculates the active / idle status of each task based on the timing when the task assignment unit 22 assigns a task, the timing when a task is interrupted, or the timing when a task voluntarily interrupts processing.
[0146] The task execution time information acquisition unit 110B acquires time information for task completion and the time when the task was scheduled from the task assignment unit 22 of the task management unit 21.
[0147] The task execution time information acquisition unit 110B hooks a timestamp acquisition function to the task assignment unit 22 of the task management unit 21, and uses this hook to acquire timestamps when a task is completed and when a task is scheduled.
[0148] The task execution time information acquisition unit 110B is activated when the task assignment unit 22 assigns a task, when a task is interrupted, or when a task voluntarily interrupts processing. It acquires a timestamp on the corresponding core and places the information shown in Figure 33 into the shared memory 130.
[0149] The arithmetic unit operation status derivation unit 120B derives the time information from task completion to task scheduling as idle time. Based on the information shown in Figure 33 and the information stored in the shared memory 130, the arithmetic unit operation status derivation unit 120B outputs the active / idle time progression of each arithmetic unit by the application.
[0150] Examples of output are shown below: • Screen output of active / idle time progression • File output of active / idle time progression
[0151] Figure 32 shows an example of information placed in the shared memory 130. This differs from the information placed in the shared memory 130 in Figure 5. The shared memory 130 shown in Figure 32 stores [active:2 / preempt:1 / wait:0, timestamp (microseconds), task ID]. The shared memory 130 stores information such as "the timing when the task was assigned (active)", "the timing when the task was interrupted (preempt)", "the timing when processing was voluntarily interrupted (wait)", "timestamp (timestamp)", and "task ID (task ID)".
[0152] Figure 33 shows an example of output that displays the time progression of active / idle based on information stored in the shared memory 130. As an example, Figure 33 shows the active status of task ID 34 (an example of a task).
[0153] In the output example shown in Figure 33, the screen displays the following states: from timestamp[2827559] (microseconds) to [3128660], the idle state (thick solid line in Figure 33); from timestamp[3128660] to [3361923], the active state (thick solid line in Figure 33); and then from timestamp[3361923] to [3570088], the idle state (thick solid line in Figure 33). Note that the time progression of preempt and wait is not shown in the operation status of task ID 34 shown in Figure 33.
[0154] [Implementation Example] An implementation example of the third embodiment will be described. As an implementation example, we will take the case where eBPF, a Linux function, is used.
[0155] Figure 34 is a configuration diagram showing an implementation example of the arithmetic unit idle time measurement device 100B shown in Figure 31, using eBPF, a function of Linux. The same reference numerals are used for components identical to those in Figure 31. The arithmetic unit idle time measurement device 100B shown in Figure 34 comprises a task execution time information acquisition unit 110B, an arithmetic unit operation status derivation unit 120B, and a shared memory 130.
[0156] The task execution time information acquisition unit 110B is an eBPF program loaded into the OS kernel. The task execution time information acquisition unit 110 hooks the eBPF program to run when the CPU idle instruction issuance function CPUidle() is called. When this eBPF program starts, it acquires a timestamp and places the information [active, preempt or wait, timestamp, task ID] into the eBPF map.
[0157] The shared memory 130 stores the eBPF map. The arithmetic unit operation status derivation unit 120B is a user program that performs the following roles: - Loads the eBPF program into the OS kernel. - Obtains information placed in the eBPF map. - Executes the output shown in Figure 32 based on the obtained information.
[0158] The operation of the arithmetic unit idle time measurement device 100B, configured as described above, will be explained below. <Operation of the task execution time information acquisition unit 110B> First, the operation of the task execution time information acquisition unit 110B of the arithmetic unit idle time measurement device 100B shown in Figure 34 will be explained. Figure 35 is a configuration diagram showing the operation image of the task execution time information acquisition unit 110B. The same reference numerals are used for the same components as in Figure 34. In addition, the relevant functional units are represented by thick solid lines, and functional units that are not related to the operation are represented by dashed lines. As shown in Figure 35, the task execution time information acquisition unit 110B is activated when the task assignment unit 22 assigns a task, when a task is interrupted, or when a task spontaneously interrupts processing (dashed arrow from the task assignment unit 22 to the task execution time information acquisition unit 110B in Figure 25), acquires a timestamp on the relevant core, and places the information shown in Figure 33 into the shared memory 130.
[0159] The task execution time information acquisition unit 110B, after being loaded into the OSkernel as an eBPF program or the like, performs the following operations.
[0160] Figure 36 is a flowchart showing the operation of the task execution time information acquisition unit 110B, which is activated each time the task assignment unit 22's schedule() is called. First, in step S91, the task execution time information acquisition unit 110B acquires a timestamp.
[0161] In step S92, the task execution time information acquisition unit 110B determines whether the reason the task has finished and the task assignment unit 22 has been activated is because the task assignment unit 22 interrupted the running task to start another task (preempt), or because the running task stopped itself (wait).
[0162] In step S93, the task execution time information acquisition unit 110B creates an entry in the format [preempt, timestamp, task ID] or [wait, timestamp, task ID] and adds it to the shared memory 130.
[0163] An example of the above entry format is shown in Figure 37: [active:2, preempt:1, wait:0, timestamp(usec), task ID]. Example: [1, 462789, 35] [2, 462789, 36] [0, 465788, 36] [2, 465788, 35]
[0164] In this case, whether it's preempt or wait, the task has been interrupted, indicating that the task with the corresponding task ID has become idle. Therefore, there is no need to differentiate the entry types; [idle, timestamp, task ID] is also acceptable.
[0165] When a task is marked as "preempt," it means that another task interrupted the process and executed the task that was originally scheduled to run. Therefore, it may not accurately reflect the active / idle status of the application in question. In other words, when a task is marked as "wait," it reliably reflects the CPU active / idle status of the application in question. Consequently, the reliability of CPU active / idle status information provided by an application is higher in the [preempt / wait, timestamp, taskID] format and lower in the [idle, timestamp, taskID] format.
[0166] Returning to the flow in Figure 36, in step S94, the task execution time information acquisition unit 110B determines whether or not there are any tasks that will become active from this point onward. If there are no tasks that will become active from this point onward (S94: No), the processing of this flow is terminated.
[0167] If there are any tasks that become active thereafter (S94: Yes), in step S95, the task execution time information acquisition unit 110B creates an entry for [active, timestamp, task ID], adds it to the shared memory 130, and terminates the processing of this flow. Here, it is preferable to reuse the timestamp obtained immediately after scheduling() is started. This is because the overhead of determining preempt / wait is not expected to be on the order of microseconds, while obtaining a new timestamp takes on the order of microseconds, so the former will more accurately indicate the active / idle status of the application.
[0168] <Operation of the arithmetic unit operation status derivation unit 120B> Next, the operation of the arithmetic unit operation status derivation unit 120B of the arithmetic unit idle time measuring device 100B shown in Figure 34 will be explained. Figure 38 is a configuration diagram showing the operation image of the arithmetic unit operation status derivation unit 120B. The same reference numerals are used for the same components as in Figure 34. In addition, the relevant functional units are represented by thick solid lines, and functional units that are not related to operation are represented by dashed lines. The arithmetic unit operation status derivation unit 120B shown in Figure 38 outputs the active / idle time progression based on the information stored in the shared memory 130.
[0169] Figure 39 is a flowchart showing the operation of the arithmetic unit operation status derivation unit 120B shown in Figure 38. In step S101, the arithmetic unit operation status derivation unit 120B refers to the shared memory 130. In step S102, the arithmetic unit operation status derivation unit 120B determines whether a new entry has been added.
[0170] If no new entries have been added (S102: No), in step S103 the arithmetic unit operation status derivation unit 120B determines whether or not the shared memory reference interval has been specified by the user.
[0171] This section describes how to specify the shared memory access interval. Examples of specification methods: • The user can specify the access interval as a command-line argument at startup (e.g., 1 msec). • The access interval can be permanently written into the program.
[0172] Here, specifying no reference interval or a high-frequency reference interval reduces the risk of entries overflowing even with a small shared memory, and stable operation can be expected. On the other hand, the arithmetic unit operation status derivation unit 120B performs references busily, increasing power consumption. Conversely, specifying a low-frequency reference interval reduces the increase in power consumption by the arithmetic unit operation status derivation unit 120B, but increases the risk of entries overflowing, so this is limited to cases where entries are added only infrequently (or the memory capacity of the shared memory 130 needs to be increased).
[0173] Returning to the flow in Figure 39, if the shared memory reference interval is specified by the user (S103: Yes), in step S104 the arithmetic unit operation status derivation unit 120B sleeps for the specified reference interval and returns to step S101. If the shared memory reference interval is not specified by the user (S103: No), it returns to step S101 as is.
[0174] If a new entry has been added in step S102 (S102: Yes), in step S105 the arithmetic unit operation status derivation unit 120B obtains an entry of [preempt / wait / active, timestamp, taskID] from the shared memory 130. In step S106 the arithmetic unit operation status derivation unit 120B determines whether or not there is a specification to execute sequential output.
[0175] This section describes sequential output and termination output. The user specifies whether to use sequential output or termination output at startup. <Sequential Output> - Output is added to the screen or file each time an entry is retrieved from shared memory 130. <Termination Output> - Information retrieved from shared memory 130 is temporarily held and output at termination.
[0176] Returning to the flow in Figure 39, if there is a specification to perform sequential output (S106: Yes), in step S107 the arithmetic unit operation status derivation unit 120B outputs the active / idle status to the screen or file and proceeds to step S109. If there is no specification to perform sequential output (S106: No), in step S108 the arithmetic unit operation status derivation unit 120B temporarily holds the contents of the acquired entries in memory / storage (not shown) and proceeds to step S109.
[0177] In step S109, the arithmetic unit operation status derivation unit 120B determines whether or not the termination condition is met. If the termination condition is not met (S109: No), the process returns to step S101.
[0178] Examples of termination conditions are as follows: • The user specifies the termination time at startup (e.g., terminate after 10 seconds) • The user specifies the number of termination entries at startup (e.g., terminate after 10,000 entries) • The system receives a termination command from the user (e.g., receives a signal)
[0179] If the termination condition is met (S109: Yes), in step S110, the arithmetic unit operation status derivation unit 120B determines whether or not there is a specification to execute sequential output. If there is a specification to execute sequential output (S110: Yes), the processing of this flow is terminated.
[0180] If there is no specification to perform sequential output (S110: No), in step S111, the arithmetic unit operation status derivation unit 120B outputs the active / idle status to the screen or file and terminates the processing of this flow.
[0181] [Output Examples] As mentioned above, the output examples on the screen are important from a visualization standpoint for the arithmetic unit idle time measuring device 100B. Screen output examples will be explained with reference to Figures 40 to 45. Figures 40 to 42 are screen output examples, and Figures 43 to 45 are text output examples.
[0182] 《Example of correspondence between acquired information and output (output at termination)》 Figure 40 is a diagram showing an example of the correspondence between acquired information and output (output at termination). The left diagram of Figure 40 is an example of the following information that is temporarily held in memory / storage at termination. ・Example of information that is temporarily held in memory / storage at termination … [0, 2827559, 245] [2, 3128660, 245] [1, 3361923, 245] [2, 3570088, 245] … are saved.
[0183] The arithmetic unit operation status derivation unit 120B shown in Figure 38 outputs the active / idle time progression based on the information in the left diagram of Figure 40 (arrow and symbol g in Figure 40). The upper right diagram of Figure 40 is the screen output (output example 1) of the operation status of task ID 245 in the case of preempt (task interruption by the task assignment unit 22) from the information in the left diagram of Figure 40, as determined by the arithmetic unit operation status derivation unit 120B (arrow and symbol q in the left diagram of Figure 40). The lower right diagram of Figure 40 is the screen output (output example 2) of the operation status of task ID 245 in the case of wait (voluntary processing interruption by the task) from the information in the left diagram of Figure 40, as determined by the arithmetic unit operation status derivation unit 120B. The screen output is as follows: ・Output to screen files such as .png or .jpg ・Screen output (right diagram of Figure 40)
[0184] As shown in the upper right of Figure 40 (Output Example 1), the screen displays "wait" from timestamp[2827559] (microseconds) to [3128660] (thick solid line in the upper right of Figure 40), "Active" from timestamp[3128660] to [3361923] (thick solid line in the upper right of Figure 40), and then "preempt" from timestamp[3361923] to [3570088] (thick solid line in the upper right of Figure 40).
[0185] As shown in the lower right of Figure 40 (Output Example 2), the screen displays the following states: from timestamp[2827559] (microseconds) to [3128660], the Idle state (thick solid line in the lower right of Figure 40); from timestamp[3128660] to [3361923], the Active state (thick solid line in the lower right of Figure 40); and then from timestamp[3361923] to [3570088], the Idle (state1) state (thick solid line in the lower right of Figure 40).
[0186] Here, whether it's preempt (task interruption by the task assignment function) or wait (voluntary processing interruption by the task), the idle state remains the same, so the arithmetic unit operation status derivation unit 120B displays them as idle. This also has the effect of reducing the image size and the amount of computation required for output.
[0187] On the other hand, distinguishing between preempt and wait, as in (Output Example 1), adds additional information about the active / idle status of the task in question (for example, the preempted section may have been active if there were no other tasks).
[0188] 《Examples of correspondence between acquired information and output (sequential output)》 Figures 41A and 41C show examples of correspondence between information acquired at times T, T+1, and T+2 and the output (sequential output). Figure 41A left shows an example of information acquired by the arithmetic unit operation status derivation unit 120B from the shared memory 130 at a certain time T. The arithmetic unit operation status derivation unit 120 shown in Figure 38 outputs the time progression of Active, preempt, and wait for the operation status of task ID 245 based on the information [0, 2827559, 245] in Figure 41A left (arrow and symbol r in Figure 41A left). Figure 41A right shows the screen output at time T. In Figure 41A right, none of Active, preempt, or wait are displayed on the screen.
[0189] The left diagram of Figure 41B shows an example of information obtained by the arithmetic unit operation status derivation unit 120 from the shared memory 130 at a certain time T+1. The arithmetic unit operation status derivation unit 120, shown in Figure 38, outputs the time progression of Active, preempt, and wait for the operation status of task ID 245 based on the information [2, 3128660, 245] in the left diagram of Figure 41B (arrows and symbols s in the left diagram of Figure 41B). The right diagram of Figure 41B shows the screen output at time T+1. In the right diagram of Figure 41B, wait (thick solid line in the right diagram of Figure 41B) is displayed on the screen from timestamp [2827559] to [3128660].
[0190] The left diagram of Figure 41C shows an example of information acquired by the arithmetic unit operation status derivation unit 120B from the shared memory 130 at a certain time T+2. Based on the information [1, 3361923, 245] in the left diagram of Figure 41C, the arithmetic unit operation status derivation unit 120B outputs the time progression of Active, preempt, and wait for the operation status of task ID 245 (arrow and symbol t in the left diagram of Figure 41C). The right diagram of Figure 41C shows the screen output at time T+2. The right diagram of Figure 41C displays the Active state from timestamp [3128660] to [3361923] (thick solid line in the right diagram of Figure 41C) after the wait from timestamp [2827559] to [3128660] (thick solid line in the right diagram of Figure 41C).
[0191] 《Output Image When Multiple Tasks Run on a Single CPU Core (Output at Termination)》 Figure 42 is a diagram showing the output image (output at termination) when multiple tasks (Task ID 245, ID 246) run on a single CPU core. The left diagram of Figure 42 is an example of the following information that is temporarily held in memory / storage (not shown) at termination. ・Example of information temporarily held in memory / storage at termination … [0, 2827559, 245] [1, 3128660, 246] [2, 3128660, 245] [1, 3361923, 245] [2, 3361923, 246] [0, 3570088, 246] [2, 3570088, 245] … are saved.
[0192] The arithmetic unit operation status derivation unit 120B shown in Figure 38 outputs the time progression of Active, preempt, and wait for the operation status of task ID 245 based on the information shown in the left diagram of Figure 42 (white arrow and symbol u in Figure 42). The arithmetic unit operation status derivation unit 120B outputs two images (both images in one file, or multiple files, etc.). The upper right diagram of Figure 42 is the screen output of the operation status of task ID 245 from the information shown in the left diagram of Figure 42 by the arithmetic unit operation status derivation unit 120B (arrow and symbol u in the left diagram of Figure 42). The lower right diagram of Figure 42 is the screen output of the operation status of task ID 246 from the information shown in the left diagram of Figure 42 by the arithmetic unit operation status derivation unit 120B.
[0193] The above describes examples of screen output with reference to Figures 40 to 42. Next, examples of text output will be described with reference to Figures 43 to 45. The source information (information obtained by the arithmetic unit operation status derivation unit 120B from the shared memory 130) for the screen output examples in Figures 40 to 42 and the text output examples in Figures 43 to 45 is the same; only the output format differs. Specifically, the information in the left figures of Figures 43 to 44A-44C is identical to the information in the left figures of Figures 40 to 41A-41C. The screen output examples (output example 1) and (output example 2) in the right figure of Figure 40 are shown in the right figure of Figure 43 in the text output examples (arrows and symbols v in the left figure of Figure 43). The screen output examples in the right figures of Figures 41A-41C are shown in the right figures of Figures 44A-44C in the text output examples (arrows and symbols w, x, y in the left figures of Figures 44A-44C).
[0194] Figure 45 shows an output image (output at termination) when multiple tasks (Task IDs 245, 246, and 247) are running on a single CPU core.
[0195] [Hardware Configuration] The arithmetic unit idle time measurement systems 1000, 1000A, and 1000B according to the above embodiment (Figures 1, 3, 18, and 34) are configured by a server. When the arithmetic unit idle time measurement system 1000 is configured by a server, the server is realized by a computer 900 having a configuration such as that shown in Figure 46. Figure 46 is a hardware configuration diagram showing an example of a computer 900 that realizes the functions of the arithmetic unit idle time measurement systems 1000, 1000A, and 1000B (Figures 3, 18, and 34). The computer 900 has a CPU 901, ROM 902, RAM 903, HDD 904, communication interface (I / F) 906, input / output interface (I / F) 905, and media interface (I / F) 907.
[0196] The CPU 901 operates based on programs stored in the ROM 902 or HDD 904, and controls the various parts of the arithmetic unit idle time measurement systems 1000, 1000A, and 1000B shown in Figures 3, 18, and 34. The ROM 902 stores boot programs executed by the CPU 901 when the computer 900 starts up, as well as programs that depend on the computer 900's hardware.
[0197] The CPU 901 controls input devices 910, such as a mouse or keyboard, and output devices 911, such as a display (display unit), via the input / output interface 905. The CPU 901 acquires data from the input devices 910 via the input / output interface 905 and outputs the generated data to the output devices 911. In addition to the CPU 901, a GPU (Graphics Processing Unit) or the like may also be used as a processor.
[0198] The HDD 904 stores programs executed by the CPU 901 and data used by those programs. The communication I / F 906 receives data from other devices via a communication network (e.g., NW (Network) 920) and outputs it to the CPU 901, and also transmits data generated by the CPU 901 to other devices via the communication network.
[0199] The media interface 907 reads a program or data stored in the recording medium 912 and outputs it to the CPU 901 via the RAM 903. The CPU 901 loads the program related to the desired processing from the recording medium 912 onto the RAM 903 via the media interface 907 and executes the loaded program. The recording medium 912 is an optical recording medium such as a DVD (Digital Versatile Disc) or PD (Phase Change Rewritable Disk), a magneto-optical recording medium such as an MO (Magneto Optical Disk), a magnetic recording medium, or a semiconductor memory.
[0200] For example, when computer 900 functions as a arithmetic unit idle time measurement system 1000, 1000A, 1000B configured as one device according to this embodiment, the CPU 901 of computer 900 realizes the functions of the arithmetic unit idle time measurement devices 100, 100A, 100B by executing a program loaded on RAM 903. Furthermore, data from RAM 903 is stored in HDD 904. CPU 901 reads and executes a program related to the target processing from recording medium 912. Alternatively, CPU 901 may read a program related to the target processing from another device via a communication network (NW 920).
[0201] [Effects] As described above, the arithmetic unit (CPU 11) (Figures 1, 3, 18, 34) that performs arithmetic processing for the application (Application A31) (Figures 1, 3, 18, 34) is equipped with an arithmetic unit idle time measuring device 100 (Figures 1, 3), 100A (Figure 18), 100B (Figure 34) that measures the active time while processing is being executed and the idle time while processing is paused. The device includes a task execution time information acquisition unit 110 (Figures 3, 18, 34) that acquires task management information, including task execution time information, from a task management unit 21 (Figures 1, 3, 18, 34) that performs task management to assign tasks to the arithmetic unit (CPU 11), and an arithmetic unit operation status derivation unit 120 (Figures 3, 18, 34) that derives active or idle information of each arithmetic unit by the application based on the acquired task execution time information.
[0202] In this way, the arithmetic unit idle time measuring devices 100, 100A, and 100B acquire the minimum necessary information from the task management unit 21 to reproduce the time progression without affecting the active / idle status. This reduces the overhead caused by acquiring timestamps (ideally, minimizing the overhead) and allows obtaining the original active / idle time progression of the arithmetic unit based on the application's calculations without modifying the application.
[0203] In the arithmetic unit idle time measuring devices 100 (Figures 1 and 3), 100A (Figure 18), and 100B (Figure 31), the task execution time information acquisition unit 110 (Figures 3, 18, and 31) acquires time information for the issuance and return of a pause instruction (CPU pause instruction) from the arithmetic unit pause instruction issuance unit 23 (Figures 3, 18, and 31) of the task management unit 21, and the arithmetic unit operation status derivation unit 120 (Figures 3, 18, and 31) derives the idle time from the issuance of the pause instruction to the return.
[0204] By doing so, the arithmetic unit idle time measuring devices 100, 100A, and 100B can acquire the active / idle status of the arithmetic units due to application processing without modifying the application and with minimal overhead. This makes it possible to understand the active / idle status due to the application's original processing, contributing to improvements in application design from a power saving perspective, such as setting power saving functions and allocated cores. As a result, it is possible to obtain the actual active / idle time progression of the arithmetic units due to application calculations without modifying the application, while reducing the overhead of acquiring timestamps.
[0205] In the arithmetic unit idle time measuring devices 100 (Figures 1 and 3), 100A (Figure 18), and 100B (Figure 31), the task execution time information acquisition unit 110 (Figures 3, 18, and 34) hooks a timestamp acquisition function to the arithmetic unit pause instruction issuing unit 23 (Figures 3, 18, and 34) of the task management unit 21, and uses this hook to acquire timestamps immediately before the issuance of the pause instruction and immediately after the return from the pause instruction.
[0206] In this way, for example, the task execution time information acquisition unit 110 is an eBPF program loaded into the OS kernel, and it hooks into the timing when the CPU pause instruction issuance function cpuidle() is called so that the eBPF program runs. When this eBPF program starts, it acquires a timestamp and places the information [active or idle, timestamp] into the eBPF map. As a result, just before the arithmetic unit pause instruction is issued, the task execution time information acquisition unit 110 starts, acquires a timestamp on the relevant core, and places it in the shared memory 130. Also, immediately after the arithmetic unit pause instruction is resumed, the task execution time information acquisition unit 110 starts again, acquires a timestamp on the relevant core, and places it in the shared memory 130.
[0207] Because existing OS functions can be utilized, the active / idle status of the arithmetic unit due to application processing can be managed without modifying the application, while reducing overhead.
[0208] Furthermore, according to each embodiment, the task execution time information acquisition unit 110 places the acquired timestamps, etc., in the shared memory 130, enabling real-time processing. In addition, the arithmetic unit operation status derivation unit 120 has the effect of not depending on the operation of the preceding task execution time information acquisition unit 110.
[0209] In the arithmetic unit idle time measuring device 100B (Figure 34), the task execution time information acquisition unit 110 (Figure 34) acquires time information for task completion and task scheduling from the task assignment unit 22 (Figure 34) of the task management unit 21, and the arithmetic unit operation status derivation unit 120 (Figure 34) derives the time information from task completion to task scheduling as idle time.
[0210] In this way, the arithmetic unit idle time measuring device 100B calculates the active / idle status of each task based on the timing when the task assignment unit 22 assigns a task, the timing when a task is interrupted, and the timing when a task voluntarily interrupts its processing. This allows the arithmetic unit idle time measuring device 100B to understand the active / idle status of the application based on its original processing. In particular, it can determine whether the reason a task ended and the task assignment unit 22 was started was because the task assignment unit 22 interrupted the running task to start another task (preempt), or because the running task stopped itself (wait).
[0211] In the arithmetic unit idle time measurement device 100B (Figure 34), the task execution time information acquisition unit 110 (Figure 34) hooks a timestamp acquisition function to the task assignment unit 22 (Figure 34) of the task management unit 21, and uses this hook to acquire timestamps when a task is completed and when a task is scheduled.
[0212] In this way, for example, the task execution time information acquisition unit 110 is an eBPF program loaded into the OS kernel and creates entries of [preempt, timestamp, task ID] or [wait, timestamp, task ID]. This makes it possible to determine whether the reason a task has finished and the task assignment unit 22 has been started is because the task assignment unit 22 interrupted the running task to start another task (preempt), or because the running task stopped itself (wait). The arithmetic unit idle time measurement device 100B makes it possible to determine the active / idle status of the arithmetic unit due to application processing without modifying the application and with reduced overhead.
[0213] The arithmetic unit idle time measuring device 100A (Figure 18) includes an arithmetic unit power saving function information acquisition unit 140 (Figure 18) that acquires arithmetic unit power saving function information from an arithmetic unit power saving function management unit 24 (Figure 18) that manages the power saving function of the arithmetic unit, and an arithmetic unit operation status derivation unit 120 (Figure 18) derives the power saving function state during idle based on the acquired arithmetic unit power saving function information.
[0214] In this way, the arithmetic unit power saving function information acquisition unit 140 acquires the arithmetic unit power saving function information along with the timestamp when a pause command is issued, and passes it to the task execution time information acquisition unit 110, or places it directly in the shared memory 130 (Figure 18). As a result, the arithmetic unit idle time measurement device 100A displays the power saving function status during idle time along with the progression of the arithmetic unit's active / idle time, making it possible to visualize the active / idle status of the arithmetic unit due to application processing in more detail.
[0215] In the arithmetic unit idle time measuring devices 100 (Figures 1 and 3), 100A (Figure 18), and 100B (Figure 34), the arithmetic unit operation status derivation unit 120 (Figures 1, 18, and 34) visualizes and outputs the time progression of the derived active or idle arithmetic units.
[0216] In this way, the arithmetic unit idle time measuring devices 100, 100A, and 100B visualize and output (display, etc.) the time progression of the derived arithmetic units' active or idle states. If the output unit is a display unit, operators can visually confirm the output information, and if the output unit is a communication function unit, the output information can be effectively utilized as data. As a result, it can be used as a tool to investigate the power consumption of existing systems and the causes of increased power consumption before introducing power-saving technologies, in order to achieve power saving effects.
[0217] In the above embodiments, the implementation is shown using Linux, and methods such as embedding an eBPF program or using a tool called perf to obtain timestamps at targeted points are employed. The same can be achieved in Windows (registered trademark) by utilizing a core function called ETW (Event-Trace-for-Windows). Tools such as WPR and Xperf can be used as substitutes for tools like eBPF and perf in Linux.
[0218] Furthermore, among the processes described in each of the embodiments and application examples above, all or part of the processes described as being performed automatically can be performed manually, or all or part of the processes described as being performed manually can be performed automatically by known methods. In addition, the processing procedures, control procedures, specific names, and information including various data and parameters shown in the above documents and drawings can be changed at will unless otherwise specified.
[0219] Furthermore, the components of each illustrated device are functionally conceptual and do not necessarily need to be physically configured as shown. In other words, the specific forms of distribution and integration of each device are not limited to those shown, and all or part of them can be functionally or physically distributed and integrated in any unit according to various loads and usage conditions.
[0220] Furthermore, each of the above configurations, functions, processing units, and processing means may be implemented in hardware, either partially or entirely, by designing them as integrated circuits, for example. Alternatively, each of the above configurations and functions may be implemented in software that allows the processor to interpret and execute programs that implement each function. Information such as programs, tables, and files that implement each function can be stored in memory, a recording device such as a hard disk or SSD (Solid State Drive), or a recording medium such as an IC (Integrated Circuit) card, an SD (Secure Digital) card, or an optical disc.
[0221] 10 Hardware (HW) 11 CPU (Arithmetic Unit) 20 OS 21 Task Management Unit 22 Task Assignment Unit 23 Arithmetic Unit Pause Instruction Issuance Unit 24 Arithmetic Unit Power Saving Function Management Unit 30 User Space 31 Application A 100, 100A, 100B Arithmetic Unit Idle Time Measurement Device 110, 110A, 110B Task Execution Time Information Acquisition Unit 120, 120A, 120B Arithmetic Unit Operation Status Derivation Unit 130 Shared Memory 140 Arithmetic Unit Power Saving Function Information Acquisition Unit 911 Output Device (Visualized and Output as described in the claim) 1000, 1000A, 1000B Arithmetic Unit Idle Time Measurement System
Claims
1. A arithmetic unit idle time measuring device for measuring active time during processing and idle time during processing in an arithmetic unit that performs arithmetic processing of an application, comprising: a task execution time information acquisition unit that acquires task management information including task execution time information from a task management unit that performs task management for assigning tasks to the arithmetic unit; and an arithmetic unit operation status derivation unit that derives active or idle information of each arithmetic unit by the application based on the acquired task execution time information.
2. The arithmetic unit idle time measuring device according to claim 1, characterized in that the task execution time information acquisition unit acquires time information for the issuance and return of a pause instruction from the arithmetic unit pause instruction issuance unit of the task management unit, and the arithmetic unit operation status derivation unit derives the time from the issuance of the pause instruction to the return as idle time.
3. The arithmetic unit idle time measuring device according to claim 2, characterized in that the task execution time information acquisition unit hooks a timestamp acquisition function to the arithmetic unit pause instruction issuance unit of the task management unit, and uses the hook to acquire timestamps immediately before the issuance of the pause instruction and immediately after the return from the pause instruction.
4. The arithmetic unit idle time measuring device according to claim 1, characterized in that the task execution time information acquisition unit acquires time information of task completion and the time when the task was scheduled from the task assignment unit of the task management unit, and the arithmetic unit operation status derivation unit derives the time information of the time when the task was scheduled from the completion of the task as idle time.
5. The arithmetic unit idle time measuring device according to claim 4, characterized in that the task execution time information acquisition unit hooks a timestamp acquisition function to the task assignment unit of the task management unit, and uses the hook to acquire a timestamp when a task is completed and when a task is scheduled.
6. The arithmetic unit idle time measuring device according to claim 1, further comprising an arithmetic unit power saving function information acquisition unit that acquires arithmetic unit power saving function information indicating the power saving function status during idle time from an arithmetic unit power saving function management unit that manages the power saving function of the arithmetic unit, wherein the arithmetic unit operation status derivation unit derives the power saving function status during idle time based on the acquired arithmetic unit power saving function information.
7. The arithmetic unit idle time measuring device according to claim 1, characterized in that the arithmetic unit operation status derivation unit visualizes and outputs the derived time progression of the active or idle state of the arithmetic unit.
8. A program for causing a computer to function as a arithmetic unit idle time measuring device according to any one of claims 1 to 7.
Citation Information
Patent Citations
Mechanism to avoid inefficient core hopping and provide hardware assisted low-power state selection
JP2011150694A
Semiconductor device and processor control method
JP2019192110A
Task scheduler device, calculation system, and task scheduling method, and program
WO2024013831A1