Virtualization performance monitoring method, device, equipment and medium

By recording the timestamp of the VCPU process at a critical time point and calculating the CPU usage rate of its running in host mode, the problem of inaccurate measurement of virtualization overhead in the prior art is solved, and more accurate virtualization performance monitoring is achieved.

CN118897775BActive Publication Date: 2025-05-16BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411026402.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2025-05-16
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

The prior art is not accurate enough when measuring virtualization overhead, which may lead to inaccurate virtualization performance monitoring results.

Method used

By obtaining the timestamp of the VCPU process entering virtual machine mode and exiting host mode, as well as the timestamp of the execution of target instructions and receiving wake-up instructions in host mode, the CPU usage of the VCPU process running in host mode is calculated, thereby determining the virtualization overhead.

Benefits of technology

This method can more accurately measure virtualization overhead and improve the accuracy and reliability of virtualization performance monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118897775B_ABST
    Figure CN118897775B_ABST
Patent Text Reader

Abstract

The disclosed embodiment relates to a virtualization performance monitoring method, device, equipment and medium, wherein the method includes: obtaining a first timestamp of a virtual central processing unit VCPU process entering a virtual machine mode and a second timestamp of the VCPU process exiting from the virtual machine mode to the host machine mode; obtaining a third timestamp of the VCPU process executing a target instruction in the host machine mode and a fourth timestamp of the VCPU process receiving a wake-up instruction in the host machine mode; the target instruction is an instruction for causing the CPU to enter a pause state; based on the first timestamp, the second timestamp, the third timestamp and the fourth timestamp, determining the CPU usage occupied by the VCPU process running in the host machine mode; determining the virtualization overhead based on the CPU usage. The disclosed embodiment determines the virtualization overhead in a more reasonable and objective manner, and can obtain a more accurate virtualization overhead, thereby ensuring the accuracy and reliability of virtualization performance monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a virtualization performance monitoring method, device, equipment and medium. Background Art

[0002] Virtualization overhead is one of the key indicators for measuring virtual machine performance. In related technologies, virtualization overhead is roughly determined by the number of times the VCPU (Virtual Central Processing Unit) exits from virtual machine mode (also called virtualization mode or guest mode) to host mode (also called physical machine mode or host mode) per unit time. It is believed that the higher the number of virtualization exits, the greater the virtualization overhead. However, this method of measuring virtualization overhead is not accurate. In fact, in some special scenarios, there may be a phenomenon that the number of virtualization exits is not large but the virtualization overhead is large, resulting in inaccurate virtualization performance monitoring results. Therefore, there is an urgent need for a technology that can accurately and reliably monitor virtualization performance. Summary of the invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a virtualization performance monitoring method, device, equipment and medium.

[0004] In a first aspect, an embodiment of the present disclosure provides a virtualization performance monitoring method, the method comprising: obtaining a first timestamp of a virtual central processing unit (VCPU) process entering a virtual machine mode and a second timestamp of the VCPU process exiting from the virtual machine mode to a host machine mode; obtaining a third timestamp of the VCPU executing a target instruction in the host machine mode and a fourth timestamp of the VCPU receiving a wake-up instruction in the host machine mode; wherein the target instruction is an instruction for causing the CPU to enter a paused state; based on the first timestamp, the second timestamp, the third timestamp and the fourth timestamp, determining the CPU usage occupied by the VCPU process running in the host machine mode; and determining the virtualization overhead based on the CPU usage.

[0005] In the second aspect, the embodiment of the present disclosure also provides a virtualization performance monitoring device, including: a first acquisition module, used to obtain a first timestamp of the VCPU process entering the virtual machine mode and a second timestamp of the VCPU process exiting from the virtual machine mode to the host machine mode; a second acquisition module, used to obtain a third timestamp of the VCPU executing the target instruction in the host machine mode and a fourth timestamp of the VCPU receiving the wake-up instruction in the host machine mode; wherein the target instruction is an instruction for causing the CPU to enter a pause state; a CPU usage determination module, used to determine the CPU usage occupied by the VCPU process running in the host machine mode based on the first timestamp, the second timestamp, the third timestamp and the fourth timestamp; a virtualization overhead determination module, used to determine the virtualization overhead based on the CPU usage.

[0006] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement a virtualization performance monitoring method as provided in an embodiment of the present disclosure.

[0007] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the virtualization performance monitoring method provided in the embodiment of the present disclosure.

[0008] The above technical solution provided by the embodiment of the present disclosure can determine the CPU usage rate occupied by the VCPU process running in the host mode based on the first timestamp of the VCPU process entering the virtual machine mode, the second timestamp of the VCPU process exiting from the virtual machine mode to the host mode, the third timestamp of the VCPU process executing the target instruction (the instruction for causing the CPU to enter the pause state) in the host mode, and the fourth timestamp of the VCPU process receiving the wake-up instruction in the host mode, thereby determining the virtualization overhead based on the CPU usage rate. The above method of determining the CPU usage rate occupied by the VCPU process running in the host mode through multiple key timestamps is simpler and faster, and the method of determining the virtualization overhead through the CPU usage rate is more reasonable and objective, and a more accurate virtualization overhead can be obtained, thereby ensuring the accuracy and reliability of virtualization performance monitoring.

[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0011] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0012] Figure 1 A flowchart of a virtualization performance monitoring method provided by an embodiment of the present disclosure;

[0013] Figure 2 A schematic diagram of a virtualization overhead determination principle provided in an embodiment of the present disclosure;

[0014] Figure 3 A schematic diagram of the structure of a virtualization performance monitoring device provided in an embodiment of the present disclosure;

[0015] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0016] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0017] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0018] With the development of cloud computing, virtualization technology has also evolved from software simulation virtualization to hardware-assisted virtualization. Hardware-assisted virtualization allows the CPU (Central Processing Unit) to directly execute the instructions of the virtual machine (VM) in the virtual machine mode without instruction translation and simulation, so the performance of the VM is close to that of the physical machine. Considering security issues, some privileged instructions are not allowed to be directly executed by the CPU. Specifically, the VCPU process running on the CPU is not allowed to execute such privileged instructions in the virtual machine mode. It must exit to the host side and then execute such commands. The simulation is completed by the virtualization monitor VMM (Virtual Machine Monitor), which can also be called virtualization monitoring software. When it comes to the implementation of VMM simulation functions, the VCPU process needs to exit to the host side, which will result in a certain performance overhead. This type of performance overhead can usually be called virtualization overhead.

[0019] Virtualization overhead is one of the key indicators for measuring virtual machine performance. The number of virtualization exits can be used to measure the severity of virtualization overhead. It is generally believed that the more virtualization exits there are, the greater the virtualization overhead. However, there may be a situation where the number of virtualization exits is not large but the virtualization overhead is relatively large, such as a lock contention scenario for the VMM. The inventor has found through research that if the CPU usage rate occupied by the VCPU process running on the host side can be accurately obtained, then the CPU usage rate can accurately and objectively measure the virtualization overhead, and serve as a quantitative indicator of the virtualization overhead. On this basis, the virtualization performance can be further accurately and reliably monitored. Based on this, the embodiments of the present disclosure provide a virtualization performance monitoring method, which is explained in detail below for ease of understanding.

[0020] Figure 1 The present invention provides a flow chart of a virtualization performance monitoring method provided by an embodiment of the present invention. The method can be executed by a virtualization performance monitoring device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method mainly includes the following steps S102 to S108:

[0021] Step S102, obtaining a first timestamp when the VCPU process enters the virtual machine mode and a second timestamp when the VCPU process exits from the virtual machine mode to the host machine mode.

[0022] VCPU represents the logical processor in the virtual machine, and the CPU will treat VCPU as a normal process. Virtual machine mode refers to the operating system or application running in the virtual machine. Correspondingly, host mode refers to the actual physical machine or operating system running the virtualization software. In actual applications, the CPU has two operating states: non-root mode and root mode. The virtual machine mode corresponds to the CPU in non-root mode, and the host mode corresponds to the CPU in root mode. The embodiment of the present disclosure does not limit the method of obtaining the timestamp. For example, the timestamp of the current system operation can be recorded by reading the system TSC (Time Stamp Counter) hardware value, that is, the timestamp is recorded based on the TSC value. It can be assumed that the first timestamp is TSC1 and the second timestamp is TSC2.

[0023] Step S104, obtain the third timestamp of the VCPU process executing the target instruction in the host mode and the fourth timestamp of the VCPU process receiving the wake-up instruction in the host mode. The target instruction is an instruction used to put the CPU into a pause state, such as a privileged instruction such as an HLT instruction or an MWAIT instruction. Similarly, the above timestamps can be recorded by TSC values, assuming that the third timestamp is TSC3 and the fourth timestamp is TSC4. It should be noted that the third timestamp and the fourth timestamp may or may not be obtained. If they are not obtained, they are both regarded as zero.

[0024] Step S106, based on the first timestamp, the second timestamp, the third timestamp and the fourth timestamp, determine the CPU usage rate occupied by the VCPU process running in the host mode. The VCPU process is created and managed by the VMM, and the CPU usage rate occupied by the VCPU process running in the host mode is also the CPU usage rate occupied by the VCPU process executing the VMM code in the host mode, which can also be regarded as the CPU usage ratio of the VMM in the host mode per unit time.

[0025] In actual applications, the above timestamps will affect the CPU usage occupied by the VCPU process running in host mode. The CPU usage occupied by the VCPU process executing VMM code in host mode can be obtained by the difference between the second timestamp and the first timestamp, and the difference between the fourth timestamp and the third timestamp.

[0026] Step S108, determining the virtualization overhead based on the CPU usage. The CPU usage occupied by the VCPU process running in the host mode is positively correlated with the virtualization overhead, that is, the higher the CPU usage occupied by the VCPU process running in the host mode, the higher the virtualization overhead. In practical applications, the CPU usage occupied by the VCPU process running in the host mode can be used as a quantitative indicator of the virtualization overhead. This method is more accurate and objective than using the number of virtualization exits as a quantitative indicator of the virtualization overhead.

[0027] In some embodiments, the above-mentioned step of determining the CPU usage occupied by the VCPU process running in host mode based on the first timestamp, the second timestamp, the third timestamp and the fourth timestamp can be determined based on the first difference between the second timestamp and the first timestamp, and the second difference between the fourth timestamp and the third timestamp when it is specifically executed.

[0028] In actual applications, when the VMM is configured not to intercept the target instruction, the second difference is zero. Specifically, when the VMM is configured not to intercept the target instruction, it can be regarded as being unable to obtain the third timestamp and the fourth timestamp, and the third timestamp and the fourth timestamp are both regarded as zero, that is, the second difference is zero. When the VMM is configured to intercept the target instruction, the third timestamp and the fourth timestamp can be obtained, so the second difference is usually not zero.

[0029] In some specific implementations, the above-mentioned determination of the CPU usage occupied by the VCPU process running in the host mode based on the first difference between the second timestamp and the first timestamp, and the second difference between the fourth timestamp and the third timestamp, can refer to the following steps A to C:

[0030] Step A, based on the first difference between the second timestamp and the first timestamp, obtain the first duration of the VCPU process running in the virtual machine mode. The first duration is equal to the first difference, and the first duration can also be understood as the time the VMM runs in the virtual machine mode. Assuming that the second timestamp is TSC2 and the first timestamp is TSC1, the first duration delta1 = TSC2-TSC1.

[0031] Step B, based on the second difference between the fourth timestamp and the third timestamp, obtain the second duration that the VCPU process is in an idle state in the virtual machine mode. The second duration is equal to the second difference. In other words, the second duration can also be understood as the duration that the VCPU process actively gives up the CPU or the duration that the virtual machine actively gives up the CPU. Assuming that the fourth timestamp is TSC4 and the third timestamp is TSC3, the second duration is delta2=TSC4-TSC3. It should be noted that if the VMM is configured to intercept target instructions such as HLT instructions or MWAIT instructions, that is, the VCPU process executes the target instruction and is intercepted by the VMM and exits to the host mode, the VCPU process actively gives up the CPU resources. In this case, the duration that the VCPU actively gives up the CPU can be obtained, that is, the second duration delta2=TSC4-TSC3 is obtained.

[0032] Step C, based on the sum of the first duration and the second duration, determine the CPU usage occupied by the VCPU process running in the host mode. In some specific implementations, step C can be performed with reference to the following steps C1 to C2:

[0033] Step C1, based on the ratio of the sum of the first duration and the second duration to the target duration, obtain the target ratio; wherein the target ratio is equal to the sum of the CPU usage occupied by the VCPU process in the virtual machine mode to execute the virtual machine code and the time ratio that the VCPU process actively gives up the CPU. Specifically, the ratio of the first duration to the target duration is the CPU usage occupied by the VCPU process in the virtual machine mode to execute the virtual machine code, and the ratio of the second duration to the target duration is the time ratio that the VCPU process actively gives up the CPU, and the sum of the two is the target ratio. The target duration is the CPU usage duration of the VCPU process, and the CPU usage can be calculated by calculating the time ratio, such as the CPU usage occupied by the VCPU process in the virtual machine mode to execute the virtual machine code is (delta1+delta2) / t. Wherein, t is the target duration.

[0034] Step C2, based on the difference between 1 and the target ratio, obtain the CPU usage rate occupied by the VCPU process running in the host mode. The CPU usage rate occupied by the VCPU process running in the host mode is 1-(delta1+delta2) / t. In other words, 1-(delta1+delta2) / t can be directly used as the virtualization overhead. It can be understood that if the VMM is configured to intercept target instructions such as HLT instructions or MWAIT instructions, the second duration delta2 may not be zero. If the VMM is configured not to intercept target instructions such as HLT instructions or MWAIT instructions, the second duration delta2 must be zero. At this time, the CPU usage rate occupied by the VCPU process running in the host mode is actually 1-delta1 / t, that is, the virtualization overhead is 1-delta1 / t.

[0035] For ease of understanding, refer to Figure 2 A schematic diagram of the determination principle of a virtualization overhead is shown, illustrating the host mode and the virtual machine mode, the first timestamp corresponds to the moment when the VCPU process enters the virtual machine mode, the second timestamp corresponds to the moment when the VCPU process exits the virtual machine mode, the third timestamp corresponds to the moment when the VCPU process executes the target instruction (HLT / MWAIT instruction), that is, the moment when the VCPU process actively gives up the CPU resources, and the fourth timestamp corresponds to the moment when the VCPU process receives the wake-up instruction, that is, wakes up the VCPU process that actively gives up the CPU, and then executes the target task indicated by the wake-up instruction. It should be noted that when calculating the CPU usage occupied by the VCPU process running in the host mode, it is necessary to consider the situation where the VCPU process actively gives up the CPU resources (executes the HLT / MWAIT instruction). For non-actively giving up the CPU resources (ordinary preemption), it will not affect the CPU usage. It may be that there are higher priority tasks on the host machine that need to be processed, so the corresponding timestamp will not be obtained. Figure 2 It is only for the purpose of brief illustration, and finally only the task switching is illustrated, and other scheduling points or process switching points may be included, which are not illustrated here. Among them, when the VMM is configured to intercept target instructions such as HLT instructions or MWAIT instructions, the third timestamp and the fourth timestamp can be obtained along the black arrow. When the VMM is configured not to intercept target instructions such as HLT instructions or MWAIT instructions, it will not flow along the black arrow, or it can be understood that even if the black arrow is followed, the third timestamp and the fourth timestamp cannot be obtained, or it can be simply regarded as that the third timestamp and the fourth timestamp are both zero, and there is no situation where the VCPU process actively gives up CPU resources.

[0036] In summary, the above method provided by the embodiment of the present disclosure is more convenient and quick in determining the CPU usage rate of the VCPU process running in the host mode through multiple key timestamps, and the method of determining the virtualization overhead through the CPU usage rate is more reasonable and objective, and a more accurate virtualization overhead can be obtained. In other words, by recording the difference between the timestamps of the VCPU process created by the VMM at several key operating points (scheduling points for actively giving up the CPU, wake-up scheduling points, entering / exiting the virtual machine mode, etc.), the virtualization overhead can be better quantified, so that the virtualization performance can be accurately and reliably monitored.

[0037] Corresponding to the aforementioned virtualization performance monitoring method, the embodiment of the present disclosure further provides a virtualization performance monitoring device, Figure 3 This is a schematic diagram of the structure of a virtualization performance monitoring device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated in an electronic device, such as Figure 3 As shown, the virtualization performance monitoring device includes:

[0038] A first acquisition module 302 is used to acquire a first timestamp of a VCPU process entering a virtual machine mode and a second timestamp of a VCPU process exiting from a virtual machine mode to a host machine mode;

[0039] The second acquisition module 304 is used to acquire a third timestamp of the VCPU executing the target instruction in the host mode and a fourth timestamp of the VCPU receiving the wake-up instruction in the host mode; wherein the target instruction is an instruction for causing the CPU to enter a pause state;

[0040] A CPU usage determination module 306, for determining a CPU usage occupied by the VCPU process running in the host mode based on the first timestamp, the second timestamp, the third timestamp and the fourth timestamp;

[0041] The virtualization overhead determination module 308 is configured to determine the virtualization overhead based on the CPU usage.

[0042] The above method of determining the CPU usage occupied by the VCPU process running in host mode through multiple key timestamps is simpler and faster, and the method of determining the virtualization overhead through the CPU usage is more reasonable and objective, and can obtain more accurate virtualization overhead, thereby ensuring the accuracy and reliability of virtualization performance monitoring.

[0043] In some embodiments, the CPU usage determination module 306 is specifically used to determine the CPU usage occupied by the VCPU process running in host mode based on a first difference between the second timestamp and the first timestamp, and a second difference between the fourth timestamp and the third timestamp.

[0044] In some implementations, when the virtual machine monitor VMM is configured not to intercept the target instruction, the second difference value is zero.

[0045] In some embodiments, the CPU usage determination module 306 is specifically used to: obtain a first duration for which the VCPU process runs in virtual machine mode based on a first difference between the second timestamp and the first timestamp; obtain a second duration for which the VCPU process is in an idle state in the virtual machine mode based on a second difference between the fourth timestamp and the third timestamp; and determine the CPU usage occupied by the VCPU process running in host machine mode based on the sum of the first duration and the second duration.

[0046] In some embodiments, the CPU usage determination module 306 is specifically used to: obtain a target ratio based on the ratio of the sum of the first duration and the second duration to the target duration; wherein the target ratio is equal to the sum of the CPU usage occupied by the VCPU process in executing virtual machine code in virtual machine mode and the proportion of time that the VCPU process actively gives up the CPU; the target duration is the CPU usage duration of the VCPU process; based on the difference between 1 and the target ratio, obtain the CPU usage occupied by the VCPU process in host mode.

[0047] In some implementations, the CPU usage is positively correlated with the virtualization overhead.

[0048] The virtualization performance monitoring device provided in the embodiments of the present disclosure can execute the virtualization performance monitoring method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0049] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device embodiment can refer to the corresponding process in the method embodiment, and will not be repeated here.

[0050] An embodiment of the present disclosure provides an electronic device, which includes: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any method in the present disclosure.

[0051] Reference below Figure 4, which shows a schematic diagram of the structure of an electronic device 400 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0052] like Figure 4 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0053] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0054] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0055] In addition to the above-mentioned methods and devices, the embodiments of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the method provided by the embodiments of the present disclosure. The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present disclosure, the programming languages ​​including object-oriented programming languages ​​such as Java, C++, etc., and also conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0056] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the virtualization performance monitoring method provided by the embodiment of the present disclosure.

[0057] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0058] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which implements the method for determining the virtualization overhead in the embodiments of the present disclosure when executed by a processor.

[0059] It is understandable that before using the technical solutions disclosed in the various embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0060] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0061] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0062] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0063] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0064] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A virtualization performance monitoring method, characterized in that: include: Obtain a first timestamp of a virtual central processing unit (VCPU) process entering a virtual machine mode and a second timestamp of the VCPU process exiting from the virtual machine mode to a host machine mode; Obtaining a third timestamp of the VCPU process executing a target instruction in the host mode and a fourth timestamp of the VCPU process receiving a wake-up instruction in the host mode; wherein the target instruction is an instruction for causing the CPU to enter a pause state; Determine, based on the first timestamp, the second timestamp, the third timestamp, and the fourth timestamp, a CPU usage rate occupied by the VCPU process running in the host mode; Determining virtualization overhead based on the CPU usage; Among them, determining the CPU usage occupied by the VCPU process running in host mode based on the first timestamp, the second timestamp, the third timestamp and the fourth timestamp includes: determining the CPU usage occupied by the VCPU process running in host mode based on a first difference between the second timestamp and the first timestamp, and a second difference between the fourth timestamp and the third timestamp.

2. The method according to claim 1, characterized in that When the virtual machine monitor VMM is configured not to intercept the target instruction, the second difference value is zero.

3. The method according to claim 1, characterized in that The determining, based on a first difference between the second timestamp and the first timestamp, and a second difference between the fourth timestamp and the third timestamp, of a CPU usage rate occupied by the VCPU process running in the host mode includes: Obtaining a first duration for which the VCPU process runs in the virtual machine mode based on a first difference between the second timestamp and the first timestamp; Based on a second difference between the fourth timestamp and the third timestamp, obtaining a second duration for which the VCPU process is in an idle state in the virtual machine mode; Based on the sum of the first duration and the second duration, determine the CPU usage occupied by the VCPU process running in the host mode.

4. The method according to claim 3, characterized in that The determining, based on the sum of the first duration and the second duration, the CPU usage rate occupied by the VCPU process running in the host mode includes: A target ratio is obtained based on the ratio of the sum of the first duration and the second duration to the target duration; wherein the target ratio is equal to the sum of the CPU usage rate occupied by the VCPU process in the virtual machine mode to execute the virtual machine code and the time ratio of the VCPU process actively giving up the CPU; the target duration is the CPU usage duration of the VCPU process; Based on the difference between 1 and the target ratio, the CPU usage rate occupied by the VCPU process running in the host mode is obtained.

5. The method according to claim 1, characterized in that: The CPU usage is positively correlated with the virtualization overhead.

6. A virtualization performance monitoring device, characterized in that: include: A first acquisition module is used to acquire a first timestamp of a VCPU process entering a virtual machine mode and a second timestamp of the VCPU process exiting from the virtual machine mode to a host machine mode; A second acquisition module is used to acquire a third timestamp when the VCPU executes a target instruction in the host mode and a fourth timestamp when the VCPU receives a wake-up instruction in the host mode; wherein the target instruction is an instruction for causing the CPU to enter a pause state; A CPU usage determination module, configured to determine a CPU usage occupied by the VCPU process running in a host mode based on the first timestamp, the second timestamp, the third timestamp, and the fourth timestamp; A virtualization overhead determination module, configured to determine the virtualization overhead based on the CPU usage; Among them, the CPU usage determination module is specifically used to determine the CPU usage occupied by the VCPU process running in host mode based on a first difference between the second timestamp and the first timestamp, and a second difference between the fourth timestamp and the third timestamp.

7. An electronic device, characterized in that: The electronic device comprises: a storage device having a computer program stored thereon; A processing device, used to execute the computer program in the storage device to implement the steps of the virtualization performance monitoring method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the virtualization performance monitoring method described in any one of claims 1-5.

9. A computer program product, characterized in that The method comprises a computer program, which, when executed by a processor, implements the virtualization performance monitoring method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • CPU utilization rate simulation method and device and electronic equipment

    CN113590448A

  • Anti-frosting control method and device and air conditioner

    CN114151927A