Method and device for determining video memory distribution data, readable medium and electronic equipment
By collecting and analyzing the interface call information of the target host process, determining the video memory allocation data, the video memory overflow problem is solved, and efficient allocation and optimization of video memory resources is achieved.
Patent Information
- Application Number
- CN202311828657.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-27
- Publication Date
- 2025-06-27
AI Technical Summary
The existing technology is difficult to effectively solve the problem of memory overflow, resulting in graphics applications crashes, image rendering failures or display exceptions.
The target host process collects interface call information, transmits it to the preset video memory resource analysis application, and determines the video memory allocation data of each preset data display unit based on the identification information.
It realizes the acquisition of fine-grained video memory allocation data at the interface level, helps to more clearly grasp the allocation and release behavior of video memory resources, thereby assisting in optimizing the use of video memory resources.
Smart Images

Figure CN120216159A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of analysis of video memory data, and specifically, to a method, apparatus, readable medium, and electronic device for determining video memory allocation data. Background Art
[0002] Video memory is a dedicated memory space in a computer system for storing graphic data, which is crucial for the performance and quality of graphic rendering. Larger and faster video memory can provide better visual effects and response performance, and developers can manage the allocation, release, and data transfer of video memory through graphic APIs (such as DirectX and OpenGL) to optimize the use of video memory resources. Among them, D3D11 video memory refers to the video memory used by the Direct3D 11 graphic API, which is mainly used to store graphic data, textures, and other related information.
[0003] When the graphic data stored in the video memory exceeds the available capacity of the video memory, the problem of video memory OOM (Out of Memory) will occur. This may lead to problems such as the crash of graphic applications, the failure of image rendering, or abnormal display. Summary of the Invention
[0004] This Summary of the Invention section is provided to introduce concepts in a concise form that will be described in detail in the following Detailed Implementation section. This Summary of the Invention section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to be used to limit the scope of the claimed technical solution.
[0005] In a first aspect, the present disclosure provides a method for determining video memory allocation data, the method including:
[0006] Collecting interface call information of at least one interface corresponding to the target host process through the target host process, where the interface call information includes identification information corresponding to multiple preset data display units corresponding to the target host process;
[0007] Transmitting the interface call information to a preset video memory resource analysis application;
[0008] Determining, through the preset video memory resource analysis application according to the identification information, the video memory allocation data corresponding to each of the preset data display units from the interface call information.
[0009] In a second aspect, the present disclosure provides an apparatus for determining video memory allocation data, the apparatus including:
[0010] An acquisition module, configured to acquire interface call information of at least one interface corresponding to the target host process through the target host process, where the interface call information includes identification information corresponding to a plurality of preset data display units corresponding to the target host process;
[0011] A data transmission module, configured to transmit the interface call information to a preset video memory resource analysis application;
[0012] A determination module, configured to determine, according to the identification information, through the preset video memory resource analysis application, video memory allocation data corresponding to each of the preset data display units from the interface call information.
[0013] In a third aspect, the present disclosure provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processing device, the steps of the method described in the first aspect of the present disclosure are implemented.
[0014] In a fourth aspect, the present disclosure provides an electronic device, including:
[0015] A storage device, on which a computer program is stored;
[0016] A processing device, configured to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.
[0017] Through the above technical solutions, for the target host process, by acquiring the interface call information of at least one interface corresponding to the target host process, the preset video memory resource analysis application can obtain the video memory allocation data corresponding to the target host process in units of preset data display units (such as virtual devices or each functional module corresponding to the target host process). Compared with the methods of obtaining video memory data such as code walkthrough and task manager graph display, it is possible to obtain fine-grained video memory allocation data at the interface level, so as to more clearly master the allocation and release behaviors of video memory resources, and further assist in optimizing the use of video memory resources.
[0018] Other features and advantages of the present disclosure will be described in detail in the subsequent specific implementation part. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In combination with the drawings and with reference to the following specific implementation manners, the above and other features, advantages and aspects of the embodiments of the present disclosure will become more obvious. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic, and the original elements and elements are not necessarily drawn to scale. In the drawings:
[0020] Figure 1 is a flowchart of a method for determining video memory allocation data shown according to an exemplary embodiment.
[0021] Figure 2 is a flowchart of a method for determining video memory allocation data shown according to an exemplary embodiment.
[0022] Figure 3 is according to Figure 1 shown in the embodiment of a flowchart of a method for determining video memory allocation data.
[0023] Figure 4 is a block diagram of an apparatus for determining video memory allocation data shown according to an exemplary embodiment.
[0024] Figure 5 is according to Figure 4 shown in the embodiment of a block diagram of an apparatus for determining video memory allocation data.
[0025] Figure 6 shows a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure. Detailed implementation manners
[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.
[0027] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.
[0028] As used herein, the term "including" and its variants are open-ended, that is, "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0029] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependent relationships.
[0030] It should be noted that the modifications of "one" and "multiple" mentioned in this disclosure are illustrative rather than restrictive. Those skilled in the art should understand that, unless clearly specified otherwise in the context, it should be understood as "one or more".
[0031] The names of the messages or information exchanged between multiple devices in the embodiments of this disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.
[0032] It can be understood that, before using the technical solutions disclosed in the embodiments of this disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved in this 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.
[0033] For example, when responding to receiving an active request from the user, a prompt message is sent to the user to clearly prompt the user that the operation requested by the user 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 program, server, or readable medium that executes the operations of the technical solutions of this disclosure based on the prompt message.
[0034] As an optional but non-limiting implementation manner, the manner of sending a prompt message to the user in response to receiving an active request from the user can be, for example, in the form of a pop-up window, and the prompt message can be presented in text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0035] It can be understood that the above process of notifying and obtaining the user's authorization is only illustrative and does not constitute a limitation on the implementation manners of this disclosure. Other manners that meet relevant laws and regulations can also be applied to the implementation manners of this disclosure.
[0036] At the same time, it can be understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the corresponding laws, regulations and related provisions.
[0037] The present disclosure is mainly applied to scenarios for analyzing video memory resources. For example, it can be used to analyze the allocation and release behaviors of D3D11 video memory in the professional version. After a period of use of the professional version of D3D11 video memory, the problem of out-of-memory (OOM) in the video memory appears, accounting for about 1 / 3. A large amount of insufficient video memory resources leads to the subsequent process crashes. Currently, most of the analysis software for D3D11 analyzes the rendering pipeline, and there are few software specifically for analyzing the use of video memory resources. Prior to this, the analysis of video memory was only limited to code walkthrough and the display of the task manager, and the disadvantages are obvious, with a large granularity and relatively "coarse" data, so that it is impossible to clearly understand how the video memory resources are allocated and released.
[0038] To solve the above problems, the present disclosure provides a method, device, readable medium, and electronic device for determining video memory allocation data. The following will detail the specific implementation manners of the present disclosure with reference to the accompanying drawings.
[0039] Figure 1 It is a flowchart of a method for determining video memory allocation data shown according to an exemplary embodiment. As Figure 1 shown, the method includes the following steps:
[0040] In step S101, interface call information of at least one interface corresponding to the target host process is collected through the target host process, and the interface call information includes identification information corresponding to multiple preset data display units corresponding to the target host process.
[0041] In one implementation, the user can select a target application program through a pre-developed preset video memory resource analysis application (i.e., video memory resource analysis software), and the target application program refers to the application program for which the user wants to perform video memory resource analysis. Among them, the preset video memory resource analysis application can be pre-developed based on the remote access tool RAT (Resource Analyze Tool). Generally, the operation of a program can correspond to multiple processes. In the present disclosure, the user can select one or more processes from the multiple processes corresponding to the target application program as the target host process through the preset video memory resource analysis application, so as to analyze and display the video memory allocation data corresponding to each target host process respectively.
[0042] In an embodiment of the present disclosure, the target application program may include a preset video editing application, and the target host process may include one or more processes corresponding to the preset video editing application.
[0043] In this step, the interface call information of at least one interface corresponding to each target host process can be collected respectively, and for each of the at least one interfaces, the interface call information of this interface can be collected respectively.
[0044] For the interfaces here, taking the dedicated video memory D3D11 video memory on the graphics card as an example, during the running of the target host process, a D3D11 interface needs to be allocated for this target host process. In D3D11, there are multiple interfaces for different functions and operations. For example, during the execution of the target host process, the D3D11 interfaces that need to be called include the following: D3D11CreateDeviceAndSwapChain, which is used to create the on-screen SwapChain and the device; IDXGIAdapter::CreateSwapChainForHwnd, which is used to create the on-screen SwapChain with a window; D3D11CreateDevice, which is used to create the device; ID3D11Device::CreateTexture2D, which is used to create the texture. Of course, only examples are given here, and the D3D11 interfaces that the target host process in the present disclosure needs to call during the running process are not limited to the above several, and also include other D3D11 interfaces, which will not be elaborated one by one here.
[0045] It can be understood that different D3D11 interfaces are used to implement different rendering functions and operations, and the target host process can meet various graphics rendering requirements by calling these interfaces.
[0046] The interface call information may include the identification information corresponding to multiple preset data display units corresponding to the target host process. Among them, in one embodiment, the preset data display unit may include a virtual device, and the virtual device is a device object created during the video memory allocation process for allocating video memory to the target host process. Therefore, the identification information may include the identification information of the virtual device. In addition, the target host process may include multiple functional modules. For example, when the target host process is a process of a preset video editing application, the functional modules corresponding to the target host process may include a video data decoding module and a video screen rendering module, etc. Therefore, in another embodiment, the preset data display unit may include each functional module, and the identification information may include the functional module identification.
[0047] In the present disclosure, the interface call information may further include video memory allocation related information and the stack information of the interface call; the video memory allocation related information includes at least one of the following: the creation times of video memory allocation, the release times of video memory, the data format of the data to be stored in the video memory, the occupied video memory size, the thread identification corresponding to the current video memory allocation, and the indication message of whether to bind the on-screen window.
[0048] In addition, by saving the stack information during interface calls, it is convenient to trace problems based on this stack information. For example, based on this stack information, it can be known when and where the texture is created and other operations of the process. Among them, the backtracking of the stack requires the use of the machine operation principle, and the core is to use RIP (Instruction Pointer Register), RSP (Stack Pointer Register), and RBP (Base Pointer Register) for step-by-step backtracking.
[0049] In step S102, the interface call information is transmitted to a preset video memory resource analysis application.
[0050] In the present disclosure, the acquisition of interface call information can be completed in the target host process. However, to display the acquired information, the interface call information needs to be passed out. By executing this step, the interface call information can be transmitted to the preset video memory resource analysis application based on inter-process communication, so that the preset video memory resource analysis application can perform clustering display on the interface call information.
[0051] In step S103, according to the identification information, through the preset video memory resource analysis application, the video memory allocation data corresponding to each preset data display unit is determined from the interface call information.
[0052] Among them, the preset data display unit may include a virtual device or each function module among multiple function modules included in the target host process.
[0053] First, the virtual device is described. The virtual device here refers to a device object created during video memory allocation for video memory allocation of the target host process.
[0054] Exemplarily, to allocate a D3D11 interface to the target host process, it is necessary to first create a D3D11 device object (ID3D11Device). This can be completed by calling the API function of D3D11, such as D3D11CreateDevice. After that, the created D3D11 device object can be used to create a device context object (ID3D11DeviceContext). The device context object is used to submit rendering commands, set rendering states and resources, and perform rendering operations. Other D3D11 interfaces, such as buffers (ID3D11Buffer), textures (ID3D11Texture2D), shader resource views (ID3D11ShaderResourceView), etc., can also be created and managed according to needs using the D3D11 device object.
[0055] The interface call information may include the identification information of the created virtual device. In this way, in this step, based on the identification information of the virtual device, the interface call information corresponding to different virtual devices can be clustered by a preset video memory resource analysis application, and then the video memory allocation data corresponding to each virtual device can be obtained.
[0056] For example, the video memory allocation data corresponding to each virtual device obtained by clustering may include data such as the allocation times, release times, allocated video memory size, released video memory size, occupied video memory size, the functional module of the target process corresponding to the virtual device, and video card information. In this way, for a target host process, the video memory allocation data can be analyzed and displayed in units of virtual devices. Thus, fine-grained video memory allocation data can be obtained.
[0057] In addition, a process may include multiple different functional modules. Each functional module is responsible for executing specific tasks or functions. Different functional modules can interact and share data through inter-process communication to achieve the overall function of the target host process. For example, when the target host process is a process of a preset video editing application, the functional modules corresponding to the target host process may include a video data decoding module and a video frame rendering module, etc.
[0058] Therefore, in another possible implementation manner of the present disclosure, the interface call information may further include which functional module makes the current interface call, that is, the interface call information may include a functional module identifier. Therefore, in this step, the interface call information can also be clustered by a preset video memory resource analysis application according to the functional module identifier, and then the video memory allocation data corresponding to each functional module can be obtained.
[0059] The video memory allocation data corresponding to each functional module may also include data such as the allocation times, release times, allocated video memory size, released video memory size, occupied video memory size, and video card information. In this way, for a target host process, the video memory allocation data can be analyzed and displayed in units of functional modules. For example, the video memory ratio and allocation frequency occupied by different functional modules can be analyzed, so as to obtain fine-grained video memory allocation data.
[0060] After the preset video memory resource analysis application determines the video memory allocation data corresponding to each preset data display unit, the video memory allocation data can be displayed to the user in units of the preset data display unit on the user interface of the preset video memory resource analysis application.
[0061] It should be noted that in one implementation of the present disclosure, the collection of each interface call information can be achieved by means of interface Hook (hook) on the interfaces called by the target host process. Then, the target host process can transfer the collected interface call information to the video memory resource analysis software (which can be regarded as a remote thread of the target host process) based on inter-process communication (such as shared memory, pipes, etc.). After that, the video memory resource analysis software clusters the interface call information and then obtains and displays through the interface the video memory allocation data corresponding to multiple preset data display units respectively.
[0062] By adopting the above method, for the target host process, by collecting the interface call information of at least one interface corresponding to the target host process, the preset video memory resource analysis application can obtain the video memory allocation data corresponding to the target host process in units of preset data display units (such as virtual devices or each functional module corresponding to the target host process). Compared with the methods of obtaining video memory data such as code walkthrough and task manager graphical display, it can achieve the acquisition of fine-grained video memory allocation data at the interface level, so as to more clearly master the allocation and release behavior of video memory resources, and further assist in optimizing the use of video memory resources.
[0063] In addition, the method for determining video memory allocation data provided by the present disclosure is based on the pre-developed video memory resource analysis software, which can support the analysis of the allocation and release behavior of professional version D3D11 video memory resources, and at the same time support the extension of the analysis of other video memory resource allocation methods (such as CUDA (Compute Unified Device Architecture)). Moreover, it can also analyze the use of video memory resources of multiple competing application programs to help better optimize the professional version application.
[0064] In order to analyze video memory resources for multiple software and collect interface call information for multiple software, the present disclosure realizes interface Hook for the target host process that needs to perform video memory resource analysis by presetting a video memory resource analysis application to remotely inject a DLL (Dynamic Link Library) into the target host process. Among them, remotely injecting a DLL into the target host process means loading a dynamic link library file into the target host process. By injecting a DLL into the target host process, the logic of interface Hook is implemented in the DLL, thereby modifying or extending the function behavior in the target host process without modifying the source code of the target host process. In addition, interface Hook is a technology for intercepting and modifying function calls during program operation. Through interface Hook, custom code can be injected before and after the function execution to modify or monitor the function behavior. In the present disclosure, when the target host process calls an interface, interface call information can be collected through interface Hook.
[0065] Figure 2 is a flowchart of a method for determining video memory allocation data shown according to an exemplary embodiment, as Figure 2 shown, step S101 includes the following sub-steps:
[0066] In step S1011, a preset dynamic link library file is obtained through a preset video memory resource analysis application, and the dynamic link library file is used to collect interface call information.
[0067] Among them, the dynamic link library file DLL is a dynamic link library file developed in advance based on the logic of collecting interface call information.
[0068] In step S1012, after the preset video memory resource analysis application remotely injects the dynamic link library file into the target host process, interface call information of at least one interface is collected through the target host process.
[0069] In one implementation manner, the dynamic link library file can be remotely injected into the target host process through a preset video memory resource analysis application to implement interface Hook for each interface in at least one interface, so that interface call information of each interface can be collected through interface Hook.
[0070] Considering that the present disclosure needs to realize the analysis of video memory resources for competing products' software to better optimize the professional version, therefore, the present disclosure needs to perform Hook outside the process. That is to say, the present disclosure can remotely inject an independent DLL with Hook capability after encapsulation into the target host process through a preset video memory resource analysis application.
[0071] In the process of injecting a dynamic link library file into a target host process, the process handle of the target host process and the interface address of a preset application programming interface function (or referred to as "preset API function") can be obtained, where the preset API function is used to inject the DLL into the target host process; according to the process handle, the DLL is loaded in the target host process by calling the preset API function.
[0072] Among them, the preset API function can be an API function provided by the operating system, such as LoadLibrary() and GetProcAddress(), etc. Taking LoadLibrary() as an example, by creating a remote thread, LoadLibrary() can be called in the target host process to load the DLL, so as to collect the interface call information of each interface by calling the Hook interface in the remote thread.
[0073] After injecting the DLL into the target host process for interface Hook, when the target host process calls the underlying interface, the interface call information of each interface can be collected through the interface Hook.
[0074] Figure 3 is based on Figure 1 The flowchart of a method for determining video memory allocation data shown in the illustrated embodiment is as follows Figure 3 As shown, step S102 includes the following sub-steps: The method further includes the following steps:
[0075] In step S1021, the interface call information is written into a preset shared memory by the target host process.
[0076] In this step, the target host process can write the interface call information into the preset shared memory when receiving the read completion signal sent by the preset video memory resource analysis application.
[0077] That is to say, before writing the interface call information into the preset shared memory, the target host process needs to determine whether the preset video memory resource analysis application has finished reading the previously written interface call information. When receiving the read completion signal sent by the preset video memory resource analysis application, it is considered that the preset video memory resource analysis application has finished reading, and at this time, the newly collected interface call information can be written into the preset shared memory.
[0078] In step S1022, when receiving the write completion signal sent by the target host process, the preset video memory resource analysis application reads the interface call information from the preset shared memory.
[0079] As described above, after collecting the interface call information of each interface by means of interface Hook on the interfaces called by the target host process, it is necessary to transmit the interface call information of each collected interface to a preset video memory resource analysis application. In one implementation manner of the present disclosure, data transmission between processes (i.e., from the target host process to the preset video memory resource analysis application) can be implemented based on shared memory.
[0080] Therefore, in the present disclosure, after the target host process collects the interface call information, it can write the interface call information into a preset shared memory, and after the writing is completed, send a write completion signal to the preset video memory resource analysis application (RAT), so that after the preset video memory resource analysis application obtains the write completion signal, it reads the interface call information from the preset shared memory. The preset video memory resource analysis application can cluster the read interface call information and display the video memory allocation data to the user in units of the preset data display unit.
[0081] Figure 4 It is a block diagram of a device for determining video memory allocation data shown according to an exemplary embodiment, as Figure 4 shown, the device includes:
[0082] A collection module 401, configured to collect interface call information of at least one interface corresponding to the target host process;
[0083] A data transmission module 402, configured to transmit the interface call information to a preset video memory resource analysis application;
[0084] A determination module 403, configured to determine, through the preset video memory resource analysis application according to the identification information, video memory allocation data corresponding to each of the preset data display units from the interface call information.
[0085] Optionally, the collection module 401 is configured to obtain a pre-set dynamic link library file through the preset video memory resource analysis application, and the dynamic link library file is used to implement the collection of the interface call information; after the preset video memory resource analysis application remotely injects the dynamic link library file into the target host process, the interface call information is collected through the target host process.
[0086] Optionally, the collection module 401 is configured to obtain a process handle of the target host process and an interface address of a preset application programming interface function, where the preset application programming interface function is used to inject the dynamic link library file into the target host process; the preset video memory resource analysis application loads the dynamic link library file in the target host process by calling the preset application programming interface function according to the process handle.
[0087] Optionally, the preset data display unit includes a virtual device, which is a device object created during video memory allocation for video memory allocation of the target host process, and the identification information includes the identification information of the virtual device;
[0088] The determining module 403 is configured to perform clustering on the interface call information through the preset video memory resource analysis application according to the identification information of the virtual device, so as to obtain the video memory allocation data corresponding to each virtual device.
[0089] Optionally, the target host process includes multiple functional modules, the preset data display unit includes each functional module, and the identification information includes functional module identifiers;
[0090] The determining module 403 is configured to perform clustering on the interface call information through the preset video memory resource analysis application according to the functional module identifiers, so as to obtain the video memory allocation data corresponding to each functional module.
[0091] Optionally, the interface call information includes video memory allocation related information and stack information of interface calls; the video memory allocation related information includes at least one of the following:
[0092] The number of creation times of video memory allocation, the number of video memory release times, the data format of data to be stored in video memory, the occupied video memory size, the thread identifier corresponding to the current video memory allocation, and an indication message of whether the screen window is bound.
[0093] Optionally, the data transmission module 402 is configured to write the interface call information into a preset shared memory through the target host process; and read the interface call information from the preset shared memory through the preset video memory resource analysis application when a write completion signal sent by the target host process is obtained.
[0094] Optionally, the data transmission module 402 is configured to write the interface call information into the preset shared memory when the target host process obtains a read completion signal sent by the preset video memory resource analysis application.
[0095] Optionally, Figure 5 is a block diagram of a device for determining video memory allocation data shown in the embodiments as Figure 4 shown. As Figure 5 shown, the device further includes:
[0096] A data display module 404 for displaying the video memory allocation data through the preset video memory resource analysis application.
[0097] Optionally, the target host process includes one or more processes corresponding to a preset video editing application.
[0098] By using the above device, for the target host process, by collecting the interface call information of at least one interface corresponding to the target host process, the preset video memory resource analysis application can obtain the video memory allocation data corresponding to the target host process in units of a preset data display unit (such as a virtual device or each functional module corresponding to the target host process). Compared with the video memory data acquisition methods such as code walkthrough and task manager graphics display, it can achieve the acquisition of fine-grained video memory allocation data at the interface level, so that the allocation and release behaviors of video memory resources can be grasped more clearly, and further, it can assist in optimizing the use of video memory resources.
[0099] Next, refer to Figure 6 , which shows a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure. The electronic device 600 in the embodiments 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 terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not impose any limitations on the functions and usage scopes of the embodiments of the present disclosure.
[0100] As Figure 6 shown, the electronic device 600 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage device 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0101] Generally, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 709 may allow the electronic device 600 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 6An electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices may be implemented or had.
[0102] In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
[0103] It should be noted that the above-mentioned computer-readable medium in the present disclosure can be a computer-readable signal medium, a computer-readable medium, or any combination of the two. The computer-readable medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer 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. In the present disclosure, the computer-readable medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in the present disclosure, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program codes. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable medium, and the computer-readable signal medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program codes contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0104] In some embodiments, the client can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.
[0105] The above computer-readable medium can be included in the above electronic device; it can also exist separately and not be assembled into the electronic device.
[0106] The above computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: collect interface call information for each interface corresponding to the target host process; and obtain video memory allocation data corresponding to the target host process according to the interface call information of each interface, where the video memory allocation data includes video memory allocation data corresponding to multiple preset data display units corresponding to the target host process.
[0107] Computer program code for performing the operations of the present disclosure can be written in one or more programming languages or combinations thereof. The programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++; and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).
[0108] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.
[0109] The modules described in the embodiments of the present disclosure can be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation on the module itself in some cases. For example, the determination module can also be described as "the module for determining video memory allocation data".
[0110] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Arrays (FPGA), Application Specific Integrated Circuits (ASIC), Application Specific Standard Products (ASSP), System on a Chip (SOC), Complex Programmable Logic Devices (CPLD), and so on.
[0111] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0112] According to one or more embodiments of the present disclosure, Example 1 provides a method for determining video memory allocation data, including:
[0113] Collect the interface call information of at least one interface corresponding to the target host process through the target host process, where the interface call information includes the identification information corresponding to multiple preset data display units corresponding to the target host process;
[0114] Transmit the interface call information to a preset video memory resource analysis application;
[0115] According to the identification information, through the preset video memory resource analysis application, determine the video memory allocation data corresponding to each of the preset data display units from the interface call information.
[0116] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, where collecting the interface call information of at least one interface corresponding to the target host process through the target host process includes:
[0117] Obtain a pre-set dynamic link library file through the preset video memory resource analysis application, where the dynamic link library file is used to implement the collection of the interface call information;
[0118] After the preset video memory resource analysis application remotely injects the dynamic link library file into the target host process, collect the interface call information through the target host process.
[0119] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, where the preset video memory resource analysis application remotely injecting the dynamic link library file into the target host process includes:
[0120] Obtain the process handle of the target host process and the interface address of a preset application programming interface function, where the preset application programming interface function is used to inject the dynamic link library file into the target host process;
[0121] The preset video memory resource analysis application loads the dynamic link library file in the target host process by calling the preset application programming interface function according to the process handle.
[0122] According to one or more embodiments of the present disclosure, Example 4 provides the method according to any one of Examples 1-3, where the preset data display unit includes a virtual device, and the virtual device is a device object created during the video memory allocation process for video memory allocation to the target host process, and the identification information includes the identification information of the virtual device;
[0123] The determining, according to the identification information, through the preset video memory resource analysis application, the video memory allocation data corresponding to each of the preset data display units from the interface call information includes:
[0124] After clustering the interface call information through the preset video memory resource analysis application according to the identification information of the virtual device, the video memory allocation data corresponding to each virtual device is obtained.
[0125] According to one or more embodiments of the present disclosure, Example 5 provides the method according to any one of Examples 1-3, the target host process includes a plurality of functional modules, the preset data display unit includes each of the functional modules, and the identification information includes a functional module identifier;
[0126] The determining, according to the identification information, through the preset video memory resource analysis application, the video memory allocation data corresponding to each of the preset data display units from the interface call information includes:
[0127] After clustering the interface call information through the preset video memory resource analysis application according to the functional module identifier, the video memory allocation data corresponding to each of the functional modules is obtained.
[0128] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 1, the interface call information includes video memory allocation related information and stack information of the interface call; the video memory allocation related information includes at least one of the following:
[0129] The creation times of video memory allocation, the release times of video memory, the data format of data to be stored in video memory, the occupied video memory size, the thread identifier corresponding to the current video memory allocation, and the indication message of whether to bind to the screen window.
[0130] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 1, the transmitting the interface call information to the preset video memory resource analysis application includes:
[0131] Writing the interface call information into the preset shared memory through the target host process;
[0132] In the case of obtaining the write completion signal sent by the target host process, reading the interface call information from the preset shared memory through the preset video memory resource analysis application.
[0133] According to one or more embodiments of the present disclosure, Example 8 provides the method of Example 7, the method further includes:
[0134] The target host process writes the interface call information into the preset shared memory in the case of obtaining the read completion signal sent by the preset video memory resource analysis application.
[0135] According to one or more embodiments of the present disclosure, Example 9 provides the method of Example 1, and the method further includes:
[0136] Displaying the video memory allocation data through the preset video memory resource analysis application.
[0137] According to one or more embodiments of the present disclosure, Example 10 provides the method of Example 1, and the target host process includes one or more processes corresponding to a preset video editing application.
[0138] According to one or more embodiments of the present disclosure, Example 11 provides a device for determining video memory allocation data, and the device includes:
[0139] An acquisition module, configured to acquire interface call information of at least one interface corresponding to the target host process through the target host process, where the interface call information includes identification information corresponding to a plurality of preset data display units corresponding to the target host process;
[0140] A data transmission module, configured to transmit the interface call information to a preset video memory resource analysis application;
[0141] A determination module, configured to determine, through the preset video memory resource analysis application according to the identification information, the video memory allocation data corresponding to each of the preset data display units from the interface call information.
[0142] According to one or more embodiments of the present disclosure, Example 12 provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processing device, the steps of the method according to any one of Examples 1-10 are implemented.
[0143] According to one or more embodiments of the present disclosure, Example 13 provides an electronic device, including:
[0144] A storage device, on which a computer program is stored;
[0145] A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of Examples 1-10.
[0146] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present disclosure.
[0147] Moreover, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the foregoing discussion, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, the various features that are described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0148] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. With regard to the apparatus in the above embodiments, the specific manner in which each module performs an operation has been described in detail in the embodiments related to the method and will not be elaborated herein.
Claims
1. A method for determining video memory allocation data, characterized in that, The method includes: Collecting interface call information of at least one interface corresponding to the target host process through the target host process, where the interface call information includes identification information corresponding to multiple preset data display units corresponding to the target host process; Transmitting the interface call information to a preset video memory resource analysis application; Determining, according to the identification information, through the preset video memory resource analysis application, the video memory allocation data corresponding to each of the preset data display units from the interface call information.
2. The method according to claim 1, characterized in that, The collecting, through the target host process, the interface call information of at least one interface corresponding to the target host process includes: Obtaining, through the preset video memory resource analysis application, a pre-set dynamic link library file, where the dynamic link library file is used to implement the collection of the interface call information; After the preset video memory resource analysis application remotely injects the dynamic link library file into the target host process, collecting the interface call information through the target host process.
3. The method according to claim 2, characterized in that The preset video memory resource analysis application remotely injecting the dynamic link library file into the target host process includes: Obtaining a process handle of the target host process and an interface address of a preset application programming interface function, where the preset application programming interface function is used to inject the dynamic link library file into the target host process; The preset video memory resource analysis application loading the dynamic link library file in the target host process by calling the preset application programming interface function according to the process handle.
4. The method according to any one of claims 1 to 3, characterized in that, The preset data display unit includes a virtual device, where the virtual device is a device object created during the video memory allocation process for performing video memory allocation on the target host process, and the identification information includes the identification information of the virtual device; The determining, according to the identification information, through the preset video memory resource analysis application, the video memory allocation data corresponding to each of the preset data display units from the interface call information includes: After clustering the interface call information through the preset video memory resource analysis application according to the identification information of the virtual device, obtaining the video memory allocation data corresponding to each virtual device.
5. The method according to any one of claims 1 to 3, characterized in that The target host process includes multiple functional modules, the preset data display unit includes each of the functional modules, and the identification information includes a functional module identifier; The determining, according to the identification information, through the preset video memory resource analysis application, the video memory allocation data corresponding to each of the preset data display units from the interface call information includes: After clustering the interface call information through the preset video memory resource analysis application according to the functional module identifier, obtaining the video memory allocation data corresponding to each of the functional modules.
6. The method according to claim 1, wherein The interface call information includes video memory allocation related information and stack information of the interface call; the video memory allocation related information includes at least one of the following: The creation times of video memory allocation, the release times of video memory, the data format of data to be stored in the video memory, the occupied video memory size, the thread identifier corresponding to the current video memory allocation, and an indication message of whether the screen window is bound.
7. The method according to claim 1, characterized in that Transmitting the interface call information to a preset video memory resource analysis application includes: Writing the interface call information into a preset shared memory through the target host process; When a write completion signal sent by the target host process is obtained, reading the interface call information from the preset shared memory through the preset video memory resource analysis application.
8. The method according to claim 7, wherein The method further includes: When a read completion signal sent by the preset video memory resource analysis application is obtained, the target host process writes the interface call information into the preset shared memory.
9. The method according to claim 1, wherein The method further includes: Displaying the video memory allocation data through the preset video memory resource analysis application.
10. The method according to claim 1, wherein The target host process includes one or more processes corresponding to a preset video editing application.
11. A device for determining video memory allocation data, characterized in that, The apparatus includes: An acquisition module, configured to acquire interface call information of at least one interface corresponding to the target host process through the target host process, where the interface call information includes identification information corresponding to a plurality of preset data display units corresponding to the target host process; A data transmission module, configured to transmit the interface call information to a preset video memory resource analysis application; A determination module, configured to determine, through the preset video memory resource analysis application according to the identification information, video memory allocation data corresponding to each of the preset data display units from the interface call information.
12. A computer-readable medium having a computer program stored thereon, characterized in that, When executed by a processing device, the program implements the steps of the method according to any one of claims 1-10.
13. An electronic device, characterized in that, Including: A storage device, on which a computer program is stored; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1-10.