CN105022693B - A kind of performance test methods and device of application program - Google Patents

A kind of performance test methods and device of application program Download PDF

Info

Publication number
CN105022693B
CN105022693B CN201510486357.XA CN201510486357A CN105022693B CN 105022693 B CN105022693 B CN 105022693B CN 201510486357 A CN201510486357 A CN 201510486357A CN 105022693 B CN105022693 B CN 105022693B
Authority
CN
China
Prior art keywords
occupancy
resource
compensated
cpu
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510486357.XA
Other languages
Chinese (zh)
Other versions
CN105022693A (en
Inventor
洪亮
王祉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201510486357.XA priority Critical patent/CN105022693B/en
Publication of CN105022693A publication Critical patent/CN105022693A/en
Application granted granted Critical
Publication of CN105022693B publication Critical patent/CN105022693B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of performance test methods of application program and devices.The performance test methods of the application program include: to be compensated according to the hardware resource total amount of computer to the occupancy of the hardware resource of the computer, and the unappropriated amount of hardware resources of the compensated computer is made to be equal to preset resource usable levels;Application program is run in the unappropriated hardware resource of the computer, to obtain the performance data of the application program.Using the embodiment of the present invention, the computer with different hardware resource can be accurately simulated, improves the accuracy of application program capacity test result.

Description

A kind of performance test methods and device of application program
Technical field
The present invention relates to the performance test methods and device of field of computer technology more particularly to a kind of application program.
Background technique
During development of games, test game client performance parameter index is a very important job.Pass through Game client is tested for the property, developer it can be found that game performance bottleneck, and then carry out relevant optimization work Make.
In the prior art, the computer of different hardware configurations, tester are needed to the performance test of game client Game client and performance testing tool are disposed on the computer of different hardware configurations, are tested for the property and obtain test number According to.However, this test method needs to change the computer with different hardware configurations during the test, it is time-consuming and laborious, and not Facilitate the development of automatic testing process.Moreover, being limited to the number of computers of different hardware configurations, tester can only be few Performance test is completed in operation on the computer of number specific configuration, and the hardware configuration between measuring and calculation machine is difficult to smoothly mistake It crosses, so that there are certain deviations for positioning of the developer to game client performance bottleneck.
In addition, the prior art also disposes virtual machine on computer by configuring in height, and the virtual hardware of virtual machine is set Parameter simulates the computers of different hardware configurations.When test, game client and performance testing tool are deployed in virtual machine It is interior, realize the performance test to game client.However, the setting parameter ratio of the virtual hardwares such as CPU, video card that virtual machine provides It is relatively simple, and influence of the hardware resources such as CPU, video card to game performance is very big, so that virtual machine offer is simple limited hard Part option is not able to satisfy the demand of game client performance test.
Summary of the invention
The embodiment of the present invention proposes the performance test methods and device of a kind of application program, and can accurately simulate has not With the computer of hardware resource, the accuracy of application program capacity test result is improved.
The embodiment of the present invention provides a kind of performance test methods of application program, comprising:
The occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, makes to compensate The unappropriated amount of hardware resources of the computer afterwards is equal to preset resource usable levels;
Application program is run in the unappropriated hardware resource of the computer, to obtain the property of the application program It can data.
In a preferred embodiment, the hardware resource is CPU;The occupancy of the hardware resource is CPU's Occupancy;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make The unappropriated amount of hardware resources of the compensated computer is equal to preset resource usable levels, specifically includes:
Acquire the current occupancy of the CPU;
According to collected current occupancy and preset resource usable levels, the occupancy to be compensated for obtaining the CPU is calculated Rate;
According to the cycle of operation of the occupancy to be compensated and the CPU, calculate described in obtaining within the cycle of operation The free time of CPU and operation time to be compensated;
To the free time and the operation time to be compensated alternately timing;
In the timing time of the operation time to be compensated, calculation procedure is operated in the CPU, is made compensated The unoccupied rate of the CPU reaches the resource usable levels.
Further, before the current occupancy of the acquisition CPU, further includes:
The core cpu of the CPU is set.
It is preferably carried out in mode at another, the hardware resource is memory;The memory includes physical memory;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make The unappropriated amount of hardware resources of the compensated computer is equal to preset resource usable levels, specifically includes:
Acquire the current occupancy of the memory;
According to collected current occupancy, preset resource usable levels and memory amount, calculates and obtain the memory Occupancy to be compensated;
The locking memory headroom corresponding with the occupancy to be compensated on the physical memory makes compensated described interior The unoccupied amount deposited reaches the resource usable levels.
It is preferably carried out in mode at another, the hardware resource is GPU;The occupancy of the hardware resource is GPU Occupancy;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make The unappropriated amount of hardware resources of the compensated computer is equal to preset resource usable levels, specifically includes:
The adjustable calculation formula of calculation amount is generated, and the calculation formula is operated on the GPU;
Acquisition runs the current occupancy of the GPU after the calculation formula;
According to collected current occupancy, the current unoccupied rate for obtaining the GPU is calculated;
Judge whether the current unoccupied rate of the GPU is equal to preset resource usable levels;If so, described in completing The compensation of the occupancy of GPU, if it is not, then adjusting the calculation amount of the calculation formula.
Further, the calculation formula is N rank calculation formula;Wherein, the initial value of N is 0;
The calculation amount of the adjustment calculation formula, specifically includes:
Compare the current unoccupied rate of the GPU and the size of the resource usable levels;
If the current unoccupied rate of the GPU is greater than the resource usable levels, N is assigned a value of N and adds preset stepping Value, and judge whether the N after assignment is greater than preset threshold value, if so, the calculation formula of the corresponding order of the threshold value is generated, if It is no, then the calculation formula of the corresponding order of N after generating assignment;
If the current unoccupied rate of the GPU is less than the resource usable levels, N is assigned a value of N and subtracts the step value, And the N after assignment is judged whether less than 0, if so, warning information is generated, if it is not, then generating the meter of the corresponding order of N after assignment Calculate formula.
Preferably, the N rank calculation formula is the addition or N rank multiplication of matrices of N rank vector.
It is preferably carried out in mode at another, the hardware resource is video memory;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make The unappropriated amount of hardware resources of the compensated computer reaches preset resource usable levels, specifically includes:
Acquire the current occupancy of the video memory;
According to collected current occupancy, preset resource usable levels and video memory total amount, calculates and obtain the video memory Occupancy to be compensated;
Distribution amount of ram corresponding with the occupancy to be compensated in memory;
Buffer area is created, and the amount of ram is cached to the buffer area;
Amount of ram in the buffer area is assigned in the video memory, the unoccupied amount of the compensated video memory is made Reach the resource usable levels.
Further, in the hardware resource total amount according to computer to the occupancy of the hardware resource of the computer It compensates, is equal to the unappropriated amount of hardware resources of the compensated computer before preset resource usable levels, Further include:
The resource usable levels are set;
Runnability assesses software, obtains the performance rating data of hardware resource corresponding with the resource usable levels;
The performance parameter of the performance rating data and required hardware resource is compared;
The resource usable levels are adjusted according to comparing result, make the performance of the performance rating data Yu required hardware resource Parameter is identical.
Further, the application program is game client.
Correspondingly, the embodiment of the present invention also provides a kind of performance testing device of application program, comprising:
Compensating module, for according to the hardware resource total amount of computer to the occupancy of the hardware resource of the computer into Row compensation makes the unappropriated amount of hardware resources of the compensated computer be equal to preset resource usable levels;And
Performance data obtains module, for running application program in the unappropriated hardware resource of the computer, To obtain the performance data of the application program.
In a preferred embodiment, the hardware resource is CPU;The occupancy of the hardware resource is CPU's Occupancy;
The compensating module specifically includes:
CPU acquisition unit, for acquiring the current occupancy of the CPU;
CPU computing unit, for calculating described in obtaining according to collected current occupancy and preset resource usable levels The occupancy to be compensated of CPU;
Operation time computing unit was calculated and is obtained for the cycle of operation according to the occupancy to be compensated and the CPU The free time of the CPU and operation time to be compensated within the cycle of operation;
Timing unit, for the free time and the operation time to be compensated alternately timing;And
CPU compensating unit, for calculation procedure being operated in described in the timing time of the operation time to be compensated In CPU, the unoccupied rate of the compensated CPU is made to be equal to the resource usable levels.
Further, the compensating module further include:
Core cpu setting unit, for the core cpu of the CPU to be arranged.
It is preferably carried out in mode at another, the hardware resource is memory;The memory includes physical memory;
The compensating module specifically includes:
Memory acquisition unit, for acquiring the current occupancy of the memory;
Memory computing unit, for according to collected current occupancy, preset resource usable levels and memory amount, meter Calculate the occupancy to be compensated for obtaining the memory;And
Memory compensating unit, for the locking memory sky corresponding with the occupancy to be compensated on the physical memory Between, so that the unoccupied amount of the compensated memory is reached the resource usable levels.
It is preferably carried out in mode at another, the hardware resource is GPU;The occupancy of the hardware resource is GPU Occupancy;
The compensating module specifically includes:
Calculation formula generation unit is operated in for generating the adjustable calculation formula of calculation amount, and by the calculation formula On the GPU;
GPU acquisition unit, for acquiring the current occupancy of the GPU after running the calculation formula;
GPU computing unit, for calculating and obtaining the current unoccupied of the GPU according to collected current occupancy Rate;And
Judging unit, for judging whether the current unoccupied rate of the GPU is equal to preset resource usable levels;
Unit is completed in compensation, for completing the compensation of the occupancy of the GPU when the judging unit is judged to being; And
Calculation amount adjustment unit, for adjusting the calculation amount of the calculation formula when the judging unit is determined as no.
Further, the calculation formula is N rank calculation formula;Wherein, the initial value of N is 0;
The calculation amount adjustment unit specifically includes:
Comparing subunit, for the current unoccupied rate of the GPU and the size of the resource usable levels;
The first adjustment subelement, if the current unoccupied rate for the GPU is greater than the resource usable levels, by N It is assigned a value of N and adds preset step value, and judge whether the N after assignment is greater than preset threshold value, if so, generating the threshold value phase The calculation formula of order is answered, if it is not, then generating the calculation formula of the corresponding order of N after assignment;And
Second adjustment subelement, if the current unoccupied rate for the GPU is less than the resource usable levels, by N It is assigned a value of N and subtracts the step value, and judge the N after assignment whether less than 0, if so, warning information is generated, if it is not, then generating The calculation formula of the corresponding order of N after assignment.
Preferably, the N rank calculation formula is the addition or N rank multiplication of matrices of N rank vector.
It is preferably carried out in mode at another, the hardware resource is video memory;
The compensating module specifically includes:
Video memory acquisition unit, for acquiring the current occupancy of the video memory;
Video memory computing unit, for according to collected current occupancy, preset resource usable levels and video memory total amount, meter Calculate the occupancy to be compensated for obtaining the video memory;
Amount of ram allocation unit, for the amount of ram corresponding with the occupancy to be compensated of distribution in memory;
Cache unit is cached to the buffer area for creating buffer area, and by the amount of ram;And
Video memory compensating unit makes compensated institute for the amount of ram in the buffer area to be assigned in the video memory The unoccupied amount for stating video memory reaches the resource usable levels.
Further, the performance testing device of the application program further include:
Resource usable levels setup module, for the resource usable levels to be arranged;
Performance rating data obtains module, assesses software for runnability, obtains corresponding with the resource usable levels The performance rating data of hardware resource;
Contrast module, for comparing the performance parameter of the performance rating data and required hardware resource;And
Resource usable levels adjust module, for adjusting the resource usable levels according to comparing result, make the Performance Evaluation Data are identical as the performance parameter of required hardware resource.
Further, the application program is game client.
The implementation of the embodiments of the present invention has the following beneficial effects:
The performance test methods and device of application program provided in an embodiment of the present invention, can be to the hardware resource of computer Occupancy compensate, the preset corresponding hardware resource of resource usable levels is reserved, by the computer of high-end hardware configuration It is accurately modeled to the lower computer of various hardware configurations, and obtains application program on the lower computer of various hardware configurations The performance data of operation, to improve the accuracy of application program capacity test result, and convenient for accurately testing out application program Performance bottleneck;The occupancy of the CPU of computer, memory, GPU and video memory is compensated respectively, so that accurately simulation is provided There is the computer of the default corresponding hardware resource of resource usable levels;The setting of resource usable levels can be adjusted automatically by software It is whole, make the corresponding required hardware resource of hardware resource of resource usable levels adjusted, convenient for the automatic test of application program.
Detailed description of the invention
Fig. 1 is the flow diagram of one embodiment of the performance test methods of application program provided by the invention;
Fig. 2 is that the process of one embodiment of step S1 in the performance test methods of application program provided by the invention is shown It is intended to;
Fig. 3 is that the process of second embodiment of step S1 in the performance test methods of application program provided by the invention is shown It is intended to;
Fig. 4 is that the process of the third embodiment of step S1 in the performance test methods of application program provided by the invention is shown It is intended to;
Fig. 5 is that the process of the 4th embodiment of step S1 in the performance test methods of application program provided by the invention is shown It is intended to;
Fig. 6 is the structural schematic diagram of one embodiment of the performance testing device of application program provided by the invention;
Fig. 7 is the structure of one embodiment of compensating module in the performance testing device of application program provided by the invention Schematic diagram;
Fig. 8 is the structure of second embodiment of compensating module in the performance testing device of application program provided by the invention Schematic diagram;
Fig. 9 is the structure of the third embodiment of compensating module in the performance testing device of application program provided by the invention Schematic diagram;
Figure 10 is the knot of the 4th embodiment of compensating module in the performance testing device of application program provided by the invention Structure schematic diagram.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
It is the flow diagram of one embodiment of the performance test methods of application program provided by the invention referring to Fig. 1, Include:
S1, the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, is made The unappropriated amount of hardware resources of the compensated computer is equal to preset resource usable levels;
S2, application program is run in the unappropriated hardware resource of the computer, to obtain the application program Performance data.
It should be noted that computer used in the embodiment of the present invention is generally the computer of high-end hardware configuration, thus The computer simulation is carried out to the performance test of application program at the lower computer of hardware configuration.
In simulation process, the occupancy of the hardware resource of the high-end hardware configuration computer is compensated, after compensation, The available quantity of the hardware resource of the computer is pre-set resource usable levels, i.e., the available hardware resource of the computer is to survey Hardware resource needed for examination personnel, to realize the simulation to the lower computer of hardware configuration.Simulation hardware configuration compared with Application program is run on low computer, to obtain the performance data of application program.Wherein, tester can be according to required hardware Different resource usable levels are arranged in resource, and the computer mould of high-end hardware configuration is made to be intended to be the lower calculating of various hardware configurations Machine, to realize performance test of the application program on the computer with different hardware resource.Using this analog form come real The performance test of existing application program can be improved the accuracy of application program capacity test result, and answer convenient for accurately testing out With the performance bottleneck of program
In a preferred embodiment, the hardware resource is CPU;The occupancy of the hardware resource is CPU's Occupancy.
As shown in Fig. 2, occupancy of the hardware resource total amount according to computer to the hardware resource of the computer It compensates, so that the unappropriated amount of hardware resources of the compensated computer is equal to preset resource usable levels, specifically Include:
The current occupancy of S21, the acquisition CPU;
S22, according to collected current occupancy and preset resource usable levels, calculate and obtain the to be compensated of the CPU Occupancy;
S23, according to the cycle of operation of the occupancy to be compensated and the CPU, calculate and obtain within the cycle of operation The free time of the CPU and operation time to be compensated;
S24, to the free time and the operation time to be compensated alternately timing;
S25, in the timing time of the operation time to be compensated, calculation procedure is operated in the CPU, makes to compensate The unoccupied rate of the CPU afterwards reaches the resource usable levels.
Wherein, the occupancy of CPU refers to that within cycle of operation CPU is in the time scale of operation state, and CPU's is not occupied Refer to the time scale that CPU is in idle condition within the cycle of operation with rate.Before being compensated to CPU, first adopted using CPU Sample device acquires the current occupancy of CPU in real time.CPU sampler passage capacity counter programming interface Performance Counter obtains the occupancy of CPU, and the acquisition interval of the CPU usage obtained is generally 100 milliseconds of magnitudes.Wherein, Performance Counter is that windows system provides an interface of system, program and service performance data
The compensation of the occupancy of CPU is realized by CPU compensator.First according to the current occupancy and preset CPU of CPU Resource usable levels, calculate the occupancy to be compensated of CPU.Further according to the cycle of operation of occupancy to be compensated and known CPU, When calculating the free time of CPU and operation time to be compensated in the cycle of operation, and calculation procedure being operated in operation to be compensated In, to realize the compensation of CPU usage.Wherein, operation time to be compensated according to samplers sample to CPU currently account for It is adjusted with rate dynamic.Moreover, passing through the timing function of Windows operating system offer to keep the compensation of CPU more accurate QueryPerformanceCounter function, obtain precision be up to the counter of 1 microsecond to operation time to be compensated of CPU into Row timing.In addition, the cycle of operation of CPU can adjust in a certain range, the minimum cycle of operation is 10 milliseconds, maximum operation week Phase is 100 milliseconds of the sampling period.
In addition, in order to avoid CPU sampler and compensator are switched to non-present active thread often and influence to account for CPU With accurately controlling for rate, need to call the programming interface SetPriorityClass of setting process and thread priority with CPU sampler and compensator thread priority are set highest by SetThreadPriority.
Further, before the current occupancy of the acquisition CPU, further includes:
The core cpu of the CPU is set.
On multi-core CPU, what can also be provided by windows system can be set the function of thread operation core cpu SetThreadAffinityMask API come be arranged CPU compensator process operation core cpu, make the CPU of each core cpu Occupancy is able to carry out independent compensation.In practical applications, according to the operation reserve on core cpu, to different core cpus CPU usage independently compensates.Wherein, if need to limit CPU core calculation, the CPU usage of part core can be mended Repaying is 100%, operates in application program on the CPU of remaining core.
It is preferably carried out in mode at another, the hardware resource is memory;The memory includes physical memory.
As shown in figure 3, occupancy of the hardware resource total amount according to computer to the hardware resource of the computer It compensates, so that the unappropriated amount of hardware resources of the compensated computer is equal to preset resource usable levels, specifically Include:
The current occupancy of S31, the acquisition memory;
S32, according to collected current occupancy, preset resource usable levels and memory amount, calculate and obtain in described The occupancy to be compensated deposited;
S33, the corresponding memory headroom of occupancy to be compensated is locked on the physical memory, make compensated memory Unoccupied amount reach the resource usable levels.
Wherein, memory includes physical memory and virtual memory.The acquisition of the current occupancy of memory is sampled by memory Device is realized.The APIGlobalMemoryStatusEx letter that memory sampler passes through acquisition memory usage amount in windows system Number obtains the occupancy of present physical memory and virtual memory.The compensation of EMS memory occupation amount is realized by memory compensator.It is interior Compensator is deposited according to current occupancy, the resource usable levels of preset memory and memory amount, the to be compensated of memory is calculated and accounts for Dosage.Since in windows operating system, each process has virtual address space, memory is that unit is adjusted by the page Degree, the memory of distribution may be in physical memory, it is also possible on hard disk.Wherein, the page of the distribution on physical memory is claimed For working set (Working Set).In order to allow memory compensator distribute memory all in physical memory, need using be arranged into The function SetProcessWorkingSetSize of journey working set is arranged the working set size of memory compensator process, reuses The memory of working set size needed for the memory allocation function VirtualAlloc function that operating system provides distributes, and use operation The management function VirtualLock function that system provides is by the EMS memory locked of distribution in physical memory.
It is preferably carried out in mode at another, the hardware resource is GPU;The occupancy of the hardware resource is GPU Occupancy.
As shown in figure 4, occupancy of the hardware resource total amount according to computer to the hardware resource of the computer It compensates, so that the unappropriated amount of hardware resources of the compensated computer is equal to preset resource usable levels, specifically Include:
S41, the adjustable calculation formula of calculation amount is generated, and the calculation formula is operated on the GPU;
S42, acquisition run the current occupancy of the GPU after the calculation formula;
S43, according to collected current occupancy, calculate the current unoccupied rate for obtaining the GPU;
S44, judge whether the current unoccupied rate of the GPU is equal to preset resource usable levels;If so, executing step Rapid S45, if it is not, thening follow the steps S46;
The compensation of the occupancy of S45, the completion GPU;
The calculation amount of S46, the adjustment calculation formula.
It should be noted that the occupancy of GPU, the i.e. load value of GPU are realized by GPU collector, GPU occupancy Compensation be to be realized by GPU compensator.GPU compensator first operates in calculation amount adjustable calculation formula on GPU, then GPU collector is set to pass through hardware temperatures inspection software OpenHardwareMonitor to obtain the current occupancy of GPU.Wherein, Occupancy is percentage, to can be obtained the current unoccupied rate of GPU according to the current occupancy of GPU.If GPU's is current Unoccupied rate is exactly the resource usable levels of preset GPU, then completes the compensation of the occupancy of GPU;If GPU it is current not by Occupancy is not the resource usable levels of preset GPU, then needs the calculation amount of adjustment calculation formula, transports calculation formula adjusted After row is on GPU, the current unoccupied rate of GPU is equal to the resource usable levels of preset GPU.
Further, the calculation formula is N rank calculation formula;Wherein, the initial value of N is 0;
The calculation amount of the adjustment calculation formula, specifically includes:
Compare the current unoccupied rate of the GPU and the size of the resource usable levels;
If the current unoccupied rate of the GPU is greater than the resource usable levels, N is assigned a value of N and adds preset stepping Value, and judge whether the N after assignment is greater than preset threshold value, if so, the calculation formula of the corresponding order of the threshold value is generated, if It is no, then the calculation formula of the corresponding order of N after generating assignment;
If the current unoccupied rate of the GPU is less than the resource usable levels, N is assigned a value of N and subtracts the step value, And the N after assignment is judged whether less than 0, if so, warning information is generated, if it is not, then generating the meter of the corresponding order of N after assignment Calculate formula.
It should be noted that in the adjustable N rank calculation formula of generation calculation amount for the first time, N 0.If running calculating public affairs The current unoccupied rate of GPU after formula is not the resource usable levels of preset GPU, then needs the size of adjustment N.If GPU's works as Preceding unoccupied rate is greater than the resource usable levels of GPU, then needs the numerical value for increasing N, increase a stepping on the basis of N every time Value.Wherein, step value is empirically determined by tester, and it is specified negative that the size of step value determines that compensator applies to GPU The time of load, and to the precision of GPU occupancy control, step value is bigger, then it is shorter to apply the loaded time for compensator, and right The control precision of GPU load is smaller.In addition, since calculation formula needs first to create in memory, so that the N value in calculation formula is not Can be infinitely great, thus N is there are a max-thresholds, which can be true according to the memory size of amount of ram and calculation formula type It is fixed, it can also be empirically determined by tester.If the current unoccupied rate of GPU is less than the resource usable levels of GPU, need Reduce the numerical value of N, reduces a step value on the basis of N every time.By repeatedly being adjusted to the N value in calculation formula, After operating in calculation formula adjusted on GPU, the current unoccupied rate of GPU is equal to the resource usable levels of preset GPU.
Preferably, the N rank calculation formula is the addition or N rank multiplication of matrices of N rank vector.
Wherein, the addition of N rank vector is the vector sum that two one-dimensional N rank vectors are calculated using GPU, such as calculation formula Task (n)=[A1A2A3 ... An]+[B1B2B3 ... Bn];N rank multiplication of matrices is the vector product that two N rank square matrixes are calculated using GPU, Such as calculation formula
It is preferably carried out in mode at another, the hardware resource is video memory;
As shown in figure 5, occupancy of the hardware resource total amount according to computer to the hardware resource of the computer It compensates, so that the unappropriated amount of hardware resources of the compensated computer is reached preset resource usable levels, specifically Include:
The current occupancy of S51, the acquisition video memory;
S52, according to collected current occupancy, preset resource usable levels and video memory total amount, calculate obtain it is described aobvious The occupancy to be compensated deposited;
S53, the corresponding amount of ram of occupancy to be compensated is distributed in memory;
S54, creation buffer area, and the amount of ram is cached to the buffer area;
S55, the amount of ram in the buffer area is assigned in the video memory, makes the unoccupied amount of compensated video memory Reach the resource usable levels.
Wherein, the acquisition of the current occupancy of video memory is realized by video memory collector, and the compensation of video memory occupancy passes through aobvious Deposit compensator realization.Video memory collector obtains the information of video memory using the API of DirectX, it is contemplated that different windows operations The compatibility of system, can according to the version of operating system, select GetVideoMemoryViaDXGI interface or GetVideoMemoryViaD3D9 interface obtains video memory data, wherein GetVideoMemoryViaDXGI interface exists It is used in Windows Vista later system, GetVideoMemoryViaD3D9 interface makes in Windows XP system With.
Video memory compensator is realized based on OpenCL frame.After calculating the occupancy to be compensated of video memory, first using interior The amount of ram that partition function malloc distributes occupancy size to be compensated in memory is deposited, OpenCL Buffer allocation letter is recycled Number one buffer area of clCreateBuffer function creation, and OpenCL buffer area function is write in use The amount of ram of occupancy size to be compensated is passed to buffer area by clEnqueueWriteBuffer function, finally, by buffer area Amount of ram be assigned on video card, the compensation of video memory can be realized.
Further, in the hardware resource total amount according to computer to the occupancy of the hardware resource of the computer It compensates, is equal to the unappropriated amount of hardware resources of the compensated computer before preset resource usable levels, Further include:
The resource usable levels are set;
Runnability assesses software, obtains the performance rating data of hardware resource corresponding with the resource usable levels;
The performance parameter of the performance rating data and required hardware resource is compared;
The resource usable levels are adjusted according to comparing result, make the performance of the performance rating data Yu required hardware resource Parameter is identical.
It should be noted that the parameters of Properties Control software can be set in tester, realize to computer performance Control, thus make the computer performance of high-end hardware configuration go out low-level hardware configuration computer performance.In application program In performance test, the hardware resource that tester generally pays close attention to includes CPU, memory, GPU and video card.Tester passes through program Script is respectively set the resource usable levels of CPU, memory, GPU and video card, runnability assess software benchmark obtain with The performance rating data of the corresponding hardware resource of resource usable levels, then by in the hardware database of the website benchmark The performance parameter for the hardware resource known compares, and adjusts separately four resource usable levels according to comparing result, makes Performance Evaluation Software benchmark obtain performance rating data be required hardware resource performance parameter, thus establish resource usable levels with The corresponding relationship of the hardware resource of simulation computer, convenient for the automatic test of application program.
Further, the application program is game client.
Wherein, game client is the Games Software of operation on the user computer.
The performance test methods of application program provided in an embodiment of the present invention, can be to the occupancy of the hardware resource of computer Amount compensates, and reserves the preset corresponding hardware resource of resource usable levels, by the accurate mould of the computer of high-end hardware configuration Intend into the computer of various low-level hardware configurations, and obtains the property that application program is run on various low-level hardwares configuration computer Energy data, to improve the accuracy of application program capacity test result, and convenient for accurately testing out the performance bottle of application program Neck;The occupancy of the CPU of computer, memory, GPU and video memory is compensated respectively, so that accurately simulating has default money The computer of the corresponding hardware resource of source usable levels;The setting of resource usable levels can be adjusted automatically by software, make resource The corresponding hardware resource of usable levels is required hardware resource, convenient for the automatic test of application program.
Correspondingly, can be realized in above-described embodiment the present invention also provides a kind of performance testing device of application program All processes of the performance test methods of application program.
It is the structural schematic diagram of one embodiment of the performance testing device of application program provided by the invention referring to Fig. 6, Include:
Compensating module 1, for the occupancy according to the hardware resource total amount of computer to the hardware resource of the computer It compensates, the unappropriated amount of hardware resources of the compensated computer is made to be equal to preset resource usable levels;And
Performance data obtains module 2, for running application program in the unappropriated hardware resource of the computer, To obtain the performance data of the application program.
In a preferred embodiment, the hardware resource is CPU;The occupancy of the hardware resource is CPU's Occupancy.
As shown in fig. 7, the compensating module specifically includes:
CPU acquisition unit 71, for acquiring the current occupancy of the CPU;
CPU computing unit 72, for calculating and obtaining institute according to collected current occupancy and preset resource usable levels State the occupancy to be compensated of CPU;
Operation time computing unit 73, for the cycle of operation according to the occupancy to be compensated and the CPU, calculating is obtained Obtain the free time of the CPU and operation time to be compensated within the cycle of operation;
Timing unit 74, for the free time and the operation time to be compensated alternately timing;And
CPU compensating unit 75, in the timing time of the operation time to be compensated, calculation procedure to be operated in institute It states in CPU, the unoccupied rate of the compensated CPU is made to be equal to the resource usable levels.
Further, the compensating module further include:
Core cpu setting unit, for the core cpu of the CPU to be arranged.
It is preferably carried out in mode at another, the hardware resource is memory;The memory includes physical memory.
As shown in figure 8, the compensating module specifically includes:
Memory acquisition unit 81, for acquiring the current occupancy of the memory;
Memory computing unit 82 is used for according to collected current occupancy, preset resource usable levels and memory amount, Calculate the occupancy to be compensated for obtaining the memory;And
Memory compensating unit 83, for the locking memory sky corresponding with the occupancy to be compensated on the physical memory Between, so that the unoccupied amount of the compensated memory is reached the resource usable levels.
It is preferably carried out in mode at another, the hardware resource is GPU;The occupancy of the hardware resource is GPU Occupancy.
As shown in figure 9, the compensating module specifically includes:
Calculation formula generation unit 91 is run for generating the adjustable calculation formula of calculation amount, and by the calculation formula On the GPU;
GPU acquisition unit 92, for acquiring the current occupancy of the GPU after running the calculation formula;
GPU computing unit 93 obtains the current not occupied of the GPU for calculating according to collected current occupancy With rate;
Judging unit 94, for judging whether the current unoccupied rate of the GPU is equal to preset resource usable levels;
Unit 95 is completed in compensation, for completing the benefit of the occupancy of the GPU when the judging unit is judged to being It repays;And
Calculation amount adjustment unit 96, for adjusting the calculating of the calculation formula when the judging unit is determined as no Amount.
Further, the calculation formula is N rank calculation formula;Wherein, the initial value of N is 0;
The calculation amount adjustment unit specifically includes:
Comparing subunit, for the current unoccupied rate of the GPU and the size of the resource usable levels;
The first adjustment subelement, if the current unoccupied rate for the GPU is greater than the resource usable levels, by N It is assigned a value of N and adds preset step value, and judge whether the N after assignment is greater than preset threshold value, if so, generating the threshold value phase The calculation formula of order is answered, if it is not, then generating the calculation formula of the corresponding order of N after assignment;And
Second adjustment subelement, if the current unoccupied rate for the GPU is less than the resource usable levels, by N It is assigned a value of N and subtracts the step value, and judge the N after assignment whether less than 0, if so, warning information is generated, if it is not, then generating The calculation formula of the corresponding order of N after assignment.
Preferably, the N rank calculation formula is the addition or N rank multiplication of matrices of N rank vector.
It is preferably carried out in mode at another, the hardware resource is video memory;
As shown in Figure 10, the compensating module specifically includes:
Video memory acquisition unit 101, for acquiring the current occupancy of the video memory;
Video memory computing unit 102, for total according to collected current occupancy, preset resource usable levels and video memory Amount calculates the occupancy to be compensated for obtaining the video memory;
Amount of ram allocation unit 103, for the amount of ram corresponding with the occupancy to be compensated of distribution in memory;
Cache unit 104 is cached to the buffer area for creating buffer area, and by the amount of ram;And
Video memory compensating unit 105 makes compensated for the amount of ram in the buffer area to be assigned in the video memory The unoccupied amount of the video memory reaches the resource usable levels.
Further, the performance testing device of the application program further include:
Resource usable levels setup module, for the resource usable levels to be arranged;
Performance rating data obtains module, assesses software for runnability, obtains corresponding with the resource usable levels The performance rating data of hardware resource;
Contrast module, for comparing the performance parameter of the performance rating data and required hardware resource;And
Resource usable levels adjust module, for adjusting the resource usable levels according to comparing result, make the Performance Evaluation Data are identical as the performance parameter of required hardware resource.
Further, the application program is game client.
The performance testing device of application program provided in an embodiment of the present invention, can be to the occupancy of the hardware resource of computer Amount compensates, and reserves the preset corresponding hardware resource of resource usable levels, by the accurate mould of the computer of high-end hardware configuration Intend into the computer of various low-level hardware configurations, and obtains the property that application program is run on various low-level hardwares configuration computer Energy data, to improve the accuracy of application program capacity test result, and convenient for accurately testing out the performance bottle of application program Neck;The occupancy of the CPU of computer, memory, GPU and video memory is compensated respectively, so that accurately simulating has default money The computer of the corresponding hardware resource of source usable levels;The setting of resource usable levels can be adjusted automatically by software, make resource The corresponding hardware resource of usable levels is required hardware resource, convenient for the automatic test of application program.
The above is a preferred embodiment of the present invention, it is noted that for those skilled in the art For, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also considered as Protection scope of the present invention.

Claims (12)

1. a kind of performance test methods of application program characterized by comprising
The occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, is made compensated The unappropriated amount of hardware resources of the computer is equal to preset resource usable levels;
Application program is run in the unappropriated hardware resource of the computer, to obtain the performance number of the application program According to;
Wherein, the hardware resource is CPU;The occupancy of the hardware resource is the occupancy of CPU;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make to compensate The unappropriated amount of hardware resources of the computer afterwards is equal to preset resource usable levels, specifically includes:
Acquire the current occupancy of the CPU;
According to collected current occupancy and preset resource usable levels, the occupancy to be compensated for obtaining the CPU is calculated;
According to the cycle of operation of the occupancy to be compensated and the CPU, calculates and obtain the CPU within the cycle of operation Free time and operation time to be compensated;
To the free time and the operation time to be compensated alternately timing;
In the timing time of the operation time to be compensated, calculation procedure is operated in the CPU, is made compensated described The unoccupied rate of CPU reaches the resource usable levels;Or
The hardware resource is memory;The memory includes physical memory;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make to compensate The unappropriated amount of hardware resources of the computer afterwards is equal to preset resource usable levels, specifically includes:
Acquire the current occupancy of the memory;
According to collected current occupancy, preset resource usable levels and memory amount, calculate obtain the memory wait mend Repay occupancy;
Locking memory headroom corresponding with the occupancy to be compensated, makes the compensated memory on the physical memory Unoccupied amount reaches the resource usable levels;Or
The hardware resource is GPU;The occupancy of the hardware resource is the occupancy of GPU;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make to compensate The unappropriated amount of hardware resources of the computer afterwards is equal to preset resource usable levels, specifically includes:
The adjustable calculation formula of calculation amount is generated, and the calculation formula is operated on the GPU;
Acquisition runs the current occupancy of the GPU after the calculation formula;
According to collected current occupancy, the current unoccupied rate for obtaining the GPU is calculated;
Judge whether the current unoccupied rate of the GPU is equal to preset resource usable levels;If so, completing the GPU's The compensation of occupancy, if it is not, then adjusting the calculation amount of the calculation formula;Or
The hardware resource is video memory;
It is described that the occupancy of the hardware resource of the computer is compensated according to the hardware resource total amount of computer, make to compensate The unappropriated amount of hardware resources of the computer afterwards reaches preset resource usable levels, specifically includes:
Acquire the current occupancy of the video memory;
According to collected current occupancy, preset resource usable levels and video memory total amount, calculate obtain the video memory wait mend Repay occupancy;
Distribution amount of ram corresponding with the occupancy to be compensated in memory;
Buffer area is created, and the amount of ram is cached to the buffer area;
Amount of ram in the buffer area is assigned in the video memory, the unoccupied amount of the compensated video memory is reached The resource usable levels.
2. the performance test methods of application program as described in claim 1, which is characterized in that the acquisition CPU's Before current occupancy, further includes:
The core cpu of the CPU is set.
3. the performance test methods of application program as described in claim 1, which is characterized in that the calculation formula is N rank meter Calculate formula;Wherein, the initial value of N is 0;
The calculation amount of the adjustment calculation formula, specifically includes:
Compare the current unoccupied rate of the GPU and the size of the resource usable levels;
If the current unoccupied rate of the GPU is greater than the resource usable levels, N is assigned a value of N and adds preset step value, and Whether the N after judging assignment is greater than preset threshold value, if so, the calculation formula of the corresponding order of the threshold value is generated, if it is not, then The calculation formula of the corresponding order of N after generating assignment;
If the current unoccupied rate of the GPU is less than the resource usable levels, N is assigned a value of N and subtracts the step value, and is sentenced Whether the N after disconnected assignment is less than 0, if so, warning information is generated, if it is not, the calculating for then generating the corresponding order of N after assignment is public Formula.
4. the performance test methods of application program as claimed in claim 3, which is characterized in that the N rank calculation formula is N rank The addition or N rank multiplication of matrices of vector.
5. such as the performance test methods of the described in any item application programs of Claims 1-4, which is characterized in that in the basis The hardware resource total amount of computer compensates the occupancy of the hardware resource of the computer, makes the compensated calculating The unappropriated amount of hardware resources of machine is equal to before preset resource usable levels, further includes:
The resource usable levels are set;
Runnability assesses software, obtains the performance rating data of hardware resource corresponding with the resource usable levels;
The performance parameter of the performance rating data and required hardware resource is compared;
The resource usable levels are adjusted according to comparing result, make the performance parameter of the performance rating data Yu required hardware resource It is identical.
6. such as the performance test methods of the described in any item application programs of Claims 1-4, which is characterized in that described to apply journey Sequence is game client.
7. a kind of performance testing device of application program characterized by comprising
Compensating module, for being mended according to the hardware resource total amount of computer to the occupancy of the hardware resource of the computer It repays, the unappropriated amount of hardware resources of the compensated computer is made to be equal to preset resource usable levels;And
Performance data obtains module, for running application program in the unappropriated hardware resource of the computer, to obtain Take the performance data of the application program;
Wherein, the hardware resource is CPU;The occupancy of the hardware resource is the occupancy of CPU;
The compensating module specifically includes:
CPU acquisition unit, for acquiring the current occupancy of the CPU;
CPU computing unit, for calculating and obtaining the CPU according to collected current occupancy and preset resource usable levels Occupancy to be compensated;
Operation time computing unit was calculated and is obtained in institute for the cycle of operation according to the occupancy to be compensated and the CPU State the free time of the CPU and operation time to be compensated in the cycle of operation;
Timing unit, for the free time and the operation time to be compensated alternately timing;And
CPU compensating unit, in the timing time of the operation time to be compensated, calculation procedure to be operated in the CPU In, so that the unoccupied rate of the compensated CPU is equal to the resource usable levels;Or the hardware resource is memory;It is described Memory includes physical memory;
The compensating module specifically includes:
Memory acquisition unit, for acquiring the current occupancy of the memory;
Memory computing unit, for being obtained according to collected current occupancy, preset resource usable levels and memory amount, calculating Obtain the occupancy to be compensated of the memory;And
Memory compensating unit makes for the locking memory headroom corresponding with the occupancy to be compensated on the physical memory The unoccupied amount of the compensated memory reaches the resource usable levels;Or
The hardware resource is GPU;The occupancy of the hardware resource is the occupancy of GPU;
The compensating module specifically includes:
Calculation formula generation unit for generating the adjustable calculation formula of calculation amount, and the calculation formula is operated in described On GPU;
GPU acquisition unit, for acquiring the current occupancy of the GPU after running the calculation formula;
GPU computing unit, for calculating the current unoccupied rate for obtaining the GPU according to collected current occupancy;With And
Judging unit, for judging whether the current unoccupied rate of the GPU is equal to preset resource usable levels;
Unit is completed in compensation, for completing the compensation of the occupancy of the GPU when the judging unit is judged to being;And
Calculation amount adjustment unit, for adjusting the calculation amount of the calculation formula when the judging unit is determined as no;Or
The hardware resource is video memory;
The compensating module specifically includes:
Video memory acquisition unit, for acquiring the current occupancy of the video memory;
Video memory computing unit, for being obtained according to collected current occupancy, preset resource usable levels and video memory total amount, calculating Obtain the occupancy to be compensated of the video memory;
Amount of ram allocation unit, for the amount of ram corresponding with the occupancy to be compensated of distribution in memory;
Cache unit is cached to the buffer area for creating buffer area, and by the amount of ram;And
Video memory compensating unit makes compensated described aobvious for the amount of ram in the buffer area to be assigned in the video memory The unoccupied amount deposited reaches the resource usable levels.
8. the performance testing device of program the use as claimed in claim 7, which is characterized in that when the hardware resource is CPU, The compensating module further include:
Core cpu setting unit, for the core cpu of the CPU to be arranged.
9. the performance testing device of program the use as claimed in claim 7, which is characterized in that the calculation formula is N rank meter Calculate formula;Wherein, the initial value of N is 0;
The calculation amount adjustment unit specifically includes:
Comparing subunit, for the current unoccupied rate of the GPU and the size of the resource usable levels;
The first adjustment subelement, if the current unoccupied rate for the GPU is greater than the resource usable levels, by N assignment For N plus preset step value, and judge whether the N after assignment is greater than preset threshold value, if so, generating the corresponding rank of the threshold value Several calculation formula, if it is not, then generating the calculation formula of the corresponding order of N after assignment;And
Second adjustment subelement, if the current unoccupied rate for the GPU is less than the resource usable levels, by N assignment Subtract the step value for N, and judges the N after assignment whether less than 0, if so, warning information is generated, if it is not, then generating assignment The calculation formula of the corresponding order of N afterwards.
10. the performance testing device of application program as claimed in claim 9, which is characterized in that the N rank calculation formula is N The addition or N rank multiplication of matrices of rank vector.
11. such as the performance testing device of the described in any item application programs of claim 7 to 10, which is characterized in that the application The performance testing device of program further include:
Resource usable levels setup module, for the resource usable levels to be arranged;
Performance rating data obtains module, assesses software for runnability, obtains hardware corresponding with the resource usable levels The performance rating data of resource;
Contrast module, for comparing the performance parameter of the performance rating data and required hardware resource;And
Resource usable levels adjust module, for adjusting the resource usable levels according to comparing result, make the performance rating data It is identical as the performance parameter of required hardware resource.
12. such as the performance testing device of the described in any item application programs of claim 7 to 10, which is characterized in that the application Program is game client.
CN201510486357.XA 2015-08-10 2015-08-10 A kind of performance test methods and device of application program Active CN105022693B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510486357.XA CN105022693B (en) 2015-08-10 2015-08-10 A kind of performance test methods and device of application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510486357.XA CN105022693B (en) 2015-08-10 2015-08-10 A kind of performance test methods and device of application program

Publications (2)

Publication Number Publication Date
CN105022693A CN105022693A (en) 2015-11-04
CN105022693B true CN105022693B (en) 2019-03-19

Family

ID=54412681

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510486357.XA Active CN105022693B (en) 2015-08-10 2015-08-10 A kind of performance test methods and device of application program

Country Status (1)

Country Link
CN (1) CN105022693B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10303488B2 (en) * 2016-03-30 2019-05-28 Sony Interactive Entertainment Inc. Real-time adjustment of application-specific operating parameters for backwards compatibility
CN112162820A (en) * 2020-09-23 2021-01-01 广州六环信息科技有限公司 Timing method and device of timer
CN114003310A (en) * 2021-10-29 2022-02-01 深信服科技股份有限公司 Parameter selection method, device, equipment and medium based on service scene

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102497550A (en) * 2011-12-05 2012-06-13 南京大学 Parallel acceleration method and device for motion compensation interpolation in H.264 encoding
CN104375898A (en) * 2014-11-20 2015-02-25 无锡悟莘科技有限公司 Mobile terminal CPU occupancy rate optimization method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103339514B (en) * 2010-12-14 2015-12-02 Abb技术有限公司 The self-verifying of battery object, checking and aftertreatment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102497550A (en) * 2011-12-05 2012-06-13 南京大学 Parallel acceleration method and device for motion compensation interpolation in H.264 encoding
CN104375898A (en) * 2014-11-20 2015-02-25 无锡悟莘科技有限公司 Mobile terminal CPU occupancy rate optimization method

Also Published As

Publication number Publication date
CN105022693A (en) 2015-11-04

Similar Documents

Publication Publication Date Title
Lehrig et al. CloudStore—towards scalability, elasticity, and efficiency benchmarking and analysis in Cloud computing
CN112819169B (en) Quantum control pulse generation method, device, equipment and storage medium
CN106708818A (en) Pressure testing method and system
CN106055464B (en) Data buffer storage testing schooling pressure device and method
CN102981951A (en) Platform and method of cloud test development
CN102868573B (en) Method and device for Web service load cloud test
CN103425536B (en) A kind of test resource management method of Based on Distributed system performance testing
CN105022693B (en) A kind of performance test methods and device of application program
CN106484623A (en) A kind of method of software test, apparatus and system
CN106095654A (en) Performance verification device, the system with performance verification device and method
Wang et al. Testing cloud applications under cloud-uncertainty performance effects
CN106093897B (en) A kind of the test system and test method of radar system
CN105653338B (en) A kind of update method and device of application
CN106294174B (en) The various dimensions measure and device of testing adequacy
Zhang et al. {K-Scope}: Online Performance Tracking for Dynamic Cloud Applications
CN109284229A (en) A kind of dynamic adjusting method and relevant device based on QPS
CN107038120A (en) A kind of method for testing software and equipment
Mathá et al. Simplified workflow simulation on clouds based on computation and communication noisiness
CN108681487A (en) The distributed system and tuning method of sensing algorithm arameter optimization
CN106649060A (en) Equipment performance testing method and device
CN117330935A (en) Integrated circuit testing method, device and medium
Vedam et al. Demystifying cloud benchmarking paradigm-an in depth view
Hauck et al. Ginpex: deriving performance-relevant infrastructure properties through goal-oriented experiments
EP3826233B1 (en) Enhanced selection of cloud architecture profiles
CN115509931A (en) System-based performance test method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant