A computing performance testing method, device, electronic device and storage medium
By generating random numbers and decomposing composite numbers, statistical processing capabilities, the problem that the existing technology cannot measure the integer computing performance of electronic devices is solved, and effective testing and scoring of the integer computing performance of the device is provided to help users understand the computing capabilities of the device.
Patent Information
- Application Number
- CN202011516181.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-21
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2040-12-21
AI Technical Summary
Existing calculation performance testing methods cannot effectively measure the performance of electronic devices in mathematical operations, especially integer operations.
By generating random numbers, judging and decomposing composite numbers, counting the number of composite numbers completed within the preset time, determining the calculation performance test results based on this, and adjusting the random seeds and random ranges using processor performance parameters to adapt to the performance of different devices.
The test of the integer computing performance of electronic devices is realized, which can intuitively feedback the equipment's combined decomposition processing capabilities, provide test scores, and help users understand the equipment's integer computing performance.
Smart Images

Figure CN112486792B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and in particular to a computing performance testing method, device, electronic equipment and storage medium. Background Art
[0002] With the development of technology, the functions of electronic devices such as mobile phones, laptops, and tablets are becoming increasingly powerful. At present, various application software are constantly emerging, and numerous programs and services have put forward higher requirements on the computing performance of electronic devices. The stronger the computing performance of electronic devices, the faster the electronic devices can run application software.
[0003] At present, in order to let users better understand the computing performance of electronic devices, technicians have developed evaluation software (also known as "benchmarking" software). When this evaluation software is run on an electronic device, it can test the computing performance of the electronic device through certain test methods and inform the user of the test results, thereby helping the user understand the computing performance of the electronic device.
[0004] The current computing performance testing method is to test the performance of electronic devices running application software, and the output is the performance test result of the electronic device running application software. However, in actual applications, electronic devices mainly perform mathematical operations. The current computing performance testing method cannot measure the performance of electronic devices in mathematical operations, especially in integer operations. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a computing performance testing method, device, electronic device and storage medium to implement performance testing of electronic devices in integer computing. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present invention provides a computing performance testing method, the method comprising:
[0007] Generate random numbers;
[0008] If the generated random number is a composite number, the random number is decomposed;
[0009] Count the number of composite numbers that have been decomposed within a preset time;
[0010] Based on the number of composite numbers, the calculation performance test results are determined.
[0011] Optionally, the step of generating a random number includes:
[0012] Get processor performance parameters;
[0013] Determine the random seed and random range based on processor performance parameters;
[0014] Generate random numbers based on random seeds;
[0015] If the generated random number is within the random range, the generated random number is retained.
[0016] Optionally, the step of decomposing the random number includes:
[0017] Take the random number as the search upper limit, traverse all prime numbers between 2 and the search upper limit, if the current prime number can divide the search upper limit, then determine that the current prime number is a prime factor;
[0018] The quotient of the search upper limit divided by the current prime number is set as the updated search upper limit, and the search for prime factors starts again from 2 until the updated search upper limit is 1.
[0019] Optionally, before the step of generating a random number, the method further includes:
[0020] When receiving the test start instruction, start the timer and clear the counter;
[0021] The step of counting the number of composite numbers that have been decomposed within a preset time period includes:
[0022] After the decomposition process is completed, the value of the counter is incremented by 1;
[0023] If the timer duration does not reach the preset duration, return to the step of generating a random number;
[0024] If the timing duration of the timer reaches the preset duration, the number of composite numbers that have completed the decomposition process within the preset duration is read from the counter.
[0025] Optionally, the step of determining the result of the computing performance test based on the number of composite numbers includes:
[0026] Calculate the average decomposition speed based on the number of composite numbers and the preset time;
[0027] Based on the average decomposition speed, the computing performance test result is determined, wherein the computing performance test result is a test score, and the test score is proportional to the average decomposition speed.
[0028] Optionally, after the step of determining the computing performance test result based on the number of composite numbers, the method further comprises:
[0029] Output the computing performance test results to the test interface.
[0030] In a second aspect, an embodiment of the present invention provides a computing performance testing device, the device comprising:
[0031] A generation module, used to generate random numbers;
[0032] A decomposition processing module, used for decomposing the generated random number if it is a composite number;
[0033] A statistics module is used to count the number of composite numbers that have been decomposed within a preset time period;
[0034] The determination module is used to determine the result of the operation performance test based on the number of composite numbers.
[0035] Optionally, a generation module is specifically used to obtain processor performance parameters; determine a random seed and a random range based on the processor performance parameters; generate a random number based on the random seed; if the generated random number is within the random range, retain the generated random number.
[0036] Optionally, a decomposition processing module is specifically used for taking the random number as the search upper limit, traversing all prime numbers between 2 and the search upper limit, and if the current prime number is divisible by the search upper limit, determining that the current prime number is a prime factor; the quotient value of the search upper limit divided by the current prime number is set to the search upper limit for renewal, and searching for prime factors from 2 again, until the search upper limit for renewal is 1.
[0037] Optionally, the device further comprises:
[0038] A start module, used to start the timer and clear the counter when receiving a test start instruction;
[0039] The statistical module is specifically used to add 1 to the value of the counter after the decomposition process is completed; if the timing duration of the timer does not reach the preset duration, return to the step of generating a random number; if the timing duration of the timer reaches the preset duration, read the number of composite numbers that have completed the decomposition process within the preset duration from the counter.
[0040] Optionally, a determination module is specifically used to calculate an average decomposition speed based on the number of composite numbers and a preset time length; based on the average decomposition speed, an operation performance test result is determined, wherein the operation performance test result is a test score, and the test score is proportional to the average decomposition speed.
[0041] Optionally, the device further comprises:
[0042] The output module is used to output the computing performance test results to the test interface.
[0043] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store a computer program; and the processor is used to implement the method provided in the first aspect of the embodiment of the present invention when executing the computer program stored in the memory.
[0044] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method provided in the first aspect of the embodiment of the present invention is implemented.
[0045] In a fifth aspect, an embodiment of the present invention further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method provided in the first aspect of the embodiment of the present invention.
[0046] Beneficial effects of the embodiments of the present invention:
[0047] In the solution provided by the embodiment of the present invention, a random number is generated, and the generated random number is judged. If the generated random number is a composite number, the random number is decomposed, and the number of composite numbers that have been decomposed within a preset time is counted. Based on the number of composite numbers, the computing performance test result is determined. Integers are mainly divided into composite numbers and prime numbers. Any composite number can be decomposed into the product of multiple prime numbers. By decomposing the randomly generated composite number and counting the number of composite numbers that have been decomposed within a preset time, the ability of the electronic device to decompose composite numbers can be tested, that is, how many composite numbers can be decomposed within a period of time, thereby realizing the performance test of the electronic device in integer computing. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A schematic diagram of a flow chart of a computing performance testing method according to an embodiment of the present invention;
[0050] Figure 2 A schematic diagram of a flow chart of another computing performance testing method according to an embodiment of the present invention;
[0051] Figure 3 A flowchart of another computing performance testing method according to an embodiment of the present invention;
[0052] Figure 4 A flowchart of another computing performance testing method according to an embodiment of the present invention;
[0053] Figure 5 A schematic diagram of the structure of a computing performance testing device according to an embodiment of the present invention;
[0054] Figure 6Schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] In order to implement performance testing of electronic devices in integer operations, an embodiment of the present invention provides a method, device, electronic device and storage medium for computing performance testing. The computing performance testing method provided by an embodiment of the present invention is first introduced below.
[0057] The execution subject of the computing performance testing method provided in the embodiment of the present invention is: an electronic device with mathematical computing capabilities, such as a mobile phone, a laptop computer, a tablet computer, a PC (Personal Computer), etc.
[0058] like Figure 1 As shown, a computing performance testing method provided by an embodiment of the present invention may include the following steps.
[0059] S101, generate a random number.
[0060] S102: If the generated random number is a composite number, decomposition processing is performed on the random number.
[0061] S103, counting the number of composite numbers that have completed the decomposition process within a preset time period.
[0062] S104, determining a computing performance test result based on the number of composite numbers.
[0063] By applying the embodiment of the present invention, a random number is generated, and the generated random number is judged. If the generated random number is a composite number, the random number is decomposed, and the number of composite numbers that have been decomposed within a preset time is counted. Based on the number of composite numbers, the computing performance test result is determined. Integers are mainly divided into composite numbers and prime numbers. Any composite number can be decomposed into the product of multiple prime numbers. By decomposing the randomly generated composite number and counting the number of composite numbers that have been decomposed within a preset time, the ability of the electronic device to decompose composite numbers can be tested, that is, how many composite numbers can be decomposed within a period of time, thereby realizing the performance test of the electronic device in integer computing.
[0064] When performing the computing performance test, the embodiment of the present invention generates a random number. Since integer computing mainly includes the decomposition of composite numbers, after the random number is generated, it is necessary to judge whether the generated random number is a composite number. If the generated random number is a composite number, the generated random number is decomposed. If the generated random number is not a composite number, it cannot be decomposed, and the random number should be discarded and a new random number should be generated.
[0065] Among them, composite numbers refer to numbers that are greater than 1 and can be divided by other positive integers in addition to 1 and itself. In contrast, prime numbers (also called prime numbers) are neither prime numbers nor composite numbers. Obviously, the smallest composite number is 4, and the smallest prime number is 2.
[0066] In a specific implementation of an embodiment of the present invention, multiple random numbers can be generated at one time, and each random number can be judged in turn whether it is a composite number, and if it is a composite number, it can be decomposed; or a random number can be generated first, and it can be judged whether it is a composite number. If it is a composite number, it can be decomposed. After the decomposition is completed, another random number can be generated and the above steps can be re-executed.
[0067] Specifically, the step of decomposing the random number may specifically be: taking the random number as the search upper limit, traversing all prime numbers between 2 and the search upper limit, and determining that the current prime number is a prime factor if the current prime number is divisible by the search upper limit; setting the quotient of the search upper limit divided by the current prime number as the search upper limit for update, and searching for the prime factor from 2 again, until the search upper limit for update is 1.
[0068] Any composite number can be decomposed into the product of multiple prime numbers. Based on this, assuming that the random number generated is N, the specific decomposition process is exactly: take N as the search upper limit, traverse all prime numbers from 2 to N, if the current prime number P can divide N evenly, i.e. N%P=0, then think that the current prime number P is a prime factor. If the current prime number P cannot divide N evenly, then the current prime number P should be abandoned, and the next prime number is continued to be searched. Then N is set to N / P (the quotient value of the search upper limit divided by the current prime number is set to the search upper limit for renewal), and the prime factor is searched from 2 again, until the search upper limit for renewal is 1.
[0069] The electronic device continuously decomposes random numbers that are composite numbers, and counts the number of composite numbers that have completed the decomposition process. The integer computing performance of the electronic device is mainly reflected in the number of composite numbers that can complete the decomposition process within the working time (i.e., the preset time). The more composite numbers that can complete the decomposition process within the working time, the better the integer computing performance of the electronic device. In an embodiment of the present invention, it is necessary to count the number of composite numbers that have completed the decomposition process within the preset time, and the computing performance test result can be determined based on the number of composite numbers obtained by statistics. The determined computing performance test result can be a specific scoring score, or a result indicating the performance level such as excellent, good, medium, or poor. The number of composite numbers obtained by statistics can also be directly used as the computing performance test result, which is not specifically limited here.
[0070] In practical applications, the computing performance test results are generally fed back to users. In order to facilitate users to more intuitively see the quality of the computing performance of electronic devices, the computing performance test results are usually set as test scores. Accordingly, the step of determining the computing performance test results based on the number of composite numbers can be specifically: calculating the average decomposition speed based on the number of composite numbers and the preset time; determining the computing performance test results based on the average decomposition speed, wherein the computing performance test results are test scores, and the test scores are proportional to the average decomposition speed.
[0071] The average decomposition speed refers to the number of composite numbers that the electronic device can complete the decomposition processing in a unit time. When the test starts, the start time can be recorded, and when the preset time is reached, the end time can be recorded. Then the average decomposition speed = the number of composite numbers / (end time-start time), or the number of composite numbers can be directly divided by the preset time to obtain the average decomposition speed. There is a positive proportional relationship between the test score and the average decomposition speed. That is, the faster the average decomposition speed, the better the integer calculation performance of the electronic device, and a higher test score can be assigned accordingly. In a specific application, the full score of the test score can be set to 10 points or 100 points. When the test score is assigned based on the average decomposition speed, it can be assigned in the range of 0 points to the full score.
[0072] based on Figure 1 In the embodiment shown, another computing performance testing method provided by the embodiment of the present invention is as follows: Figure 2 As shown, the following steps may be included.
[0073] S201, obtaining processor performance parameters.
[0074] S202, determining a random seed and a random range according to processor performance parameters.
[0075] S203, generating a random number based on the random seed.
[0076] S204: If the generated random number is within the random range and is a composite number, decomposition processing is performed on the random number.
[0077] S205, counting the number of composite numbers that have completed the decomposition process within a preset time period.
[0078] S206, determining a computing performance test result based on the number of composite numbers.
[0079] Generally, the random numbers of computers are pseudo-random numbers. Usually, a random seed (true random number, usually a fixed value) is obtained as the initial condition, and then a certain algorithm is used to iterate and generate random numbers. The random number sequence generated with the same random seed is the same. The random range refers to the reasonable range of values that electronic devices can process.
[0080] The random seed and random range are generally related to the processing performance of the processor. In an embodiment of the present invention, the random seed and random range are adjustable. The specific adjustment method is to first obtain the processor performance parameters. The processor performance parameters refer to the attribute parameters that can reflect the processing power of the processor, usually including the number of CPU (Central Processing Unit) cores and frequency. The larger the processor performance parameters (for example, the larger the number of CPU cores, the larger the frequency, etc.), the stronger the ability of the processor to perform integer operations. Correspondingly, the larger the processor performance parameters, the larger the random seed can be set, and the wider the random range can be set, and vice versa. Therefore, according to the processor performance parameters, the values of the random seed and the random range are determined, and the adjustment of the random seed and the random range can be achieved. Specifically, the random seed and the random range are determined according to the processor performance parameters. The mapping relationship between the processor performance parameters and the random seed and the random range can be pre-set. The mapping relationship represents the positive correlation between the processor performance parameters and the random seed and the random range. After the processor performance parameters are obtained, the corresponding random seed and random range can be obtained based on the mapping relationship.
[0081] After determining the random seed and random range, a random number can be generated based on the random seed. Specifically, the method of generating random numbers based on the random seed can adopt the square median method, the linear congruential method and other methods. These methods are all methods for generating random numbers based on random seeds that are commonly used in the field and will not be repeated here. If the generated random number is within the random range and is a composite number, it means that the generated random number is a reasonable composite number that the electronic device can handle, and subsequent composite number decomposition processing can be performed. If the generated random number is not within the random range, it means that the generated random number is not suitable, and the random number should be discarded and a new random number should be generated.
[0082] Through the embodiments of the present invention, the random seed and the random range can be adjusted, so that the size of the generated composite number can be controlled, and electronic devices with different performances can be flexibly adapted.
[0083] based on Figure 1 In the embodiment shown, another computing performance testing method provided by the embodiment of the present invention is as follows: Figure 3 As shown, the following steps may be included.
[0084] S301, when receiving a test start instruction, start a timer and clear the counter.
[0085] S302, generate a random number.
[0086] S303: If the generated random number is a composite number, decomposition processing is performed on the random number.
[0087] S304: After the decomposition process is completed, the value of the counter is incremented by 1.
[0088] S305, determining whether the timing duration of the timer reaches the preset duration, if so, executing S306, if not, returning to executing S302.
[0089] S306, reading from a counter the number of composite numbers that have completed the decomposition process within a preset time period.
[0090] S307, determining the computing performance test result based on the number of composite numbers.
[0091] Generally, the computing performance test of an electronic device is triggered to start, which can be triggered by the user clicking the start button on the test interface, or by the electronic device periodically starting the test. When the test is triggered, a test start instruction is generated. When the electronic device receives the test start instruction, the timer is started and the counter is cleared. The timer is used to record the duration of the computing performance test, and the counter is used to record the number of composite numbers that have completed the decomposition process. After completing a decomposition process, the value recorded by the counter is accumulated by 1.
[0092] If the timer has not reached the preset time after a decomposition process is completed, the composite number decomposition process should continue, and the step of generating random numbers should be returned to generate a new random number and decompose it again. If the timer reaches the preset time, the random number generation should be stopped, and the computing performance test result is determined based on the number of composite numbers that have been decomposed within the preset time. The specific method for determining the computing performance test result is the same as Figure 1 The method in the illustrated embodiment is the same and will not be described again here.
[0093] based on Figure 1The embodiment shown in the figure is another computing performance testing method provided by the embodiment of the present invention, such as Figure 4 As shown, the following steps may be included.
[0094] S401, generate a random number.
[0095] S402: If the generated random number is a composite number, decomposition processing is performed on the random number.
[0096] S403, counting the number of composite numbers that have completed the decomposition process within a preset time period.
[0097] S404, determining a computing performance test result based on the number of composite numbers.
[0098] S405, outputting the computing performance test results to the test interface.
[0099] After the running performance test results are determined by the method of the above embodiment, the obtained computing performance test results can be output to the test interface, which is a manual interaction interface. In this way, the user can intuitively see the performance of the electronic device in performing integer operations, especially composite number decomposition processing, from the test interface. Furthermore, if the computing performance test results of the electronic device are very good, the electronic device can be selected to process more complex integers.
[0100] For ease of understanding, the computing performance testing method provided by the embodiment of the present invention is introduced below in conjunction with a specific example. Taking the use of AnTuTu evaluation software to evaluate a PC as an example, the AnTuTu evaluation software uses composite number decomposition computing performance testing as a test item for performance evaluation.
[0101] First, the user manually opens the AnTuTu testing software and clicks the test button to start the test.
[0102] Secondly, run the computing performance test method:
[0103] The first step is to obtain the processor performance parameters, and determine the random seed seed, random range range [RAND_MIN, RAND_MAX] and working time timespan according to the processor performance parameters.
[0104] The second step is to start the timer, record the start time, and clear the counter C=0.
[0105] The third step is to generate a random number based on the random seed seed. If the random number is within the range of the lower limit RAND_MIN and the upper limit RAND_MAX, execute the fourth step, otherwise regenerate the random number.
[0106] The fourth step is to determine whether the generated random number N is a composite number. If it is a composite number, execute the fifth step, otherwise regenerate the random number in the third step.
[0107] The fifth step is to decompose the composite number. The decomposition method is as follows:
[0108] Traverse all prime numbers from 2 to N. If the current prime number P can divide N, that is, N%P=0, then the current prime number P is considered to be a prime factor. Then set N to N / P and start looking for prime factors from 2 again until N is 1, that is, all decomposition processes are completed. If the current prime number P cannot divide N, continue the cycle for the next prime number.
[0109] After the composite number is decomposed, the counter C is incremented to record the number of composite numbers that have completed the decomposition process.
[0110] Step 6: Determine whether the test duration exceeds the scheduled working duration. If not, continue to step 3. If it exceeds, end this step and record the end time.
[0111] Step 7. Calculate the average decomposition speed: Average decomposition speed = number of composite numbers / (end time - start time).
[0112] Step 8: Output the computing performance test result to the test interface, wherein the computing performance test result is a test score determined based on the average decomposition speed.
[0113] A random number within a random range is generated by using a random seed. When the generated random number is a composite number, the composite number is decomposed into the product of multiple prime numbers. The prime factors obtained are the prime number sequences that the composite number can be divided by. In a practical environment, the size of the generated composite number can be controlled by adjusting the random seed value and the random range. The performance of the electronic device in the integer operation test items can be measured by calculating the number of composite number decompositions. The random seed and random range can be adjusted to flexibly deal with electronic devices with different performances.
[0114] Based on the above method embodiment, the present invention provides a computing performance testing device, such as Figure 5 As shown, the device may include:
[0115] A generating module 510, for generating a random number;
[0116] A decomposition processing module 520, configured to decompose the generated random number if it is a composite number;
[0117] A counting module 530 is used to count the number of composite numbers that have completed the decomposition process within a preset time period;
[0118] The determination module 540 is used to determine the computing performance test result based on the number of composite numbers.
[0119] Optionally, the generation module 510 can be specifically used to obtain processor performance parameters; determine a random seed and a random range based on the processor performance parameters; generate a random number based on the random seed; if the generated random number is within the random range, retain the generated random number.
[0120] Optionally, decomposition processing module 520, specifically can be used for taking this random number as the search upper limit, traverses 2 to all prime numbers between the search upper limit, if current prime number is divisible by the search upper limit, then determines that current prime number is prime factor; The search upper limit divided by the quotient value of current prime number is set to the search upper limit of renewal, search for prime factor from 2 again, until the search upper limit of renewal is 1.
[0121] Optionally, the device may further include:
[0122] A start module, used to start the timer and clear the counter when receiving a test start instruction;
[0123] The statistical module 530 can be specifically used to add 1 to the value of the counter after the decomposition process is completed; if the timing duration of the timer has not reached the preset duration, return to the step of generating a random number; if the timing duration of the timer reaches the preset duration, read the number of composite numbers that have completed the decomposition process within the preset duration from the counter.
[0124] Optionally, the determination module 540 can be specifically used to calculate the average decomposition speed according to the number of composite numbers and the preset time length; based on the average decomposition speed, determine the computing performance test result, wherein the computing performance test result is a test score, and the test score is proportional to the average decomposition speed.
[0125] Optionally, the device may further include:
[0126] The output module is used to output the computing performance test results to the test interface.
[0127] By applying the embodiment of the present invention, a random number is generated, and the generated random number is judged. If the generated random number is a composite number, the random number is decomposed, and the number of composite numbers that have been decomposed within a preset time is counted. Based on the number of composite numbers, the computing performance test result is determined. Integers are mainly divided into composite numbers and prime numbers. Any composite number can be decomposed into the product of multiple prime numbers. By decomposing the randomly generated composite number and counting the number of composite numbers that have been decomposed within a preset time, the ability of the electronic device to decompose composite numbers can be tested, that is, how many composite numbers can be decomposed within a period of time, thereby realizing the performance test of the electronic device in integer computing.
[0128] The embodiment of the present invention further provides an electronic device, such as Figure 6As shown, it includes a processor 601 and a memory 602, wherein the memory 602 is used to store computer programs; the processor 601 is used to implement the above-mentioned computing performance testing method when executing the computer program stored in the memory 602.
[0129] The memory may include a RAM (Random Access Memory), or may include a NVM (Non-volatile Memory), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor.
[0130] The above-mentioned processor can be a general-purpose processor, including CPU, NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0131] In this embodiment, the processor can realize the following by reading the computer program stored in the memory and running the computer program: by generating a random number, judging the generated random number, if the generated random number is a composite number, decomposing the random number, counting the number of composite numbers that have completed the decomposition process within a preset time, and determining the computing performance test result based on the number of composite numbers. Integers are mainly divided into composite numbers and prime numbers. Any composite number can be decomposed into the product of multiple prime numbers. By decomposing the randomly generated composite number and counting the number of composite numbers that have completed the decomposition process within a preset time, the ability of the electronic device to decompose the composite number can be tested, that is, how many composite numbers can be decomposed within a period of time, thereby realizing the performance test of the electronic device in integer computing.
[0132] In addition, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the above-mentioned computing performance testing method is implemented.
[0133] In this embodiment, the computer-readable storage medium stores a computer program that executes the computing performance test method provided by the embodiment of the present invention when running, so that: by generating a random number, judging the generated random number, if the generated random number is a composite number, decomposing the random number, counting the number of composite numbers that have completed the decomposition process within a preset time length, and determining the computing performance test result based on the number of composite numbers. Integers are mainly divided into composite numbers and prime numbers. Any composite number can be decomposed into the product of multiple prime numbers. After decomposing the randomly generated composite number and counting the number of composite numbers that have completed the decomposition process within a preset time length, the ability of the electronic device to decompose the composite number can be tested, that is, how many composite numbers can be decomposed within a period of time, thereby realizing the performance test of the electronic device in integer operations.
[0134] In another embodiment of the present invention, a computer program product including instructions is provided, which enables the computer to execute the above-mentioned computing performance testing method when it is run on a computer.
[0135] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, DSL (Digital Subscriber Line, digital subscriber line)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD (Digital Versatile Disc)), or a semiconductor medium (such as an SSD (Solid State Disk)).
[0136] As for the computing performance testing device, electronic device, computer-readable storage medium and computer program product embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple and the relevant parts can be referred to the partial description of the method embodiments.
[0137] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0138] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing performance test device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0139] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A computing performance testing method, characterized in that: The method comprises: Generate a random number based on performance parameters of the electronic device; If the generated random number is a composite number, the random number is decomposed; Count the number of composite numbers that have been decomposed within a preset time; Based on the number of composite numbers, determining a computing performance test result of the electronic device; The step of decomposing the random number comprises: Take this random number as the search upper limit, traverse all prime numbers between 2 and the described search upper limit, if the current prime number is divisible by the described search upper limit, then determine that the described current prime number is a prime factor; The quotient value of the search upper limit divided by the current prime number is set as the updated search upper limit, and the prime factors are searched again from 2 until the updated search upper limit is 1.
2. The method according to claim 1, characterized in that The step of generating a random number according to the performance parameters of the electronic device comprises: Get processor performance parameters; Determine a random seed and a random range according to the processor performance parameter; Based on the random seed, generate a random number; If the generated random number is within the random range, the generated random number is retained.
3. The method according to claim 1, characterized in that Before the step of generating a random number according to the performance parameters of the electronic device, the method further includes: When receiving the test start instruction, start the timer and clear the counter; The step of counting the number of composite numbers that have completed the decomposition process within a preset time period includes: After the decomposition process is completed, the value of the counter is incremented by 1; If the timing duration of the timer does not reach the preset duration, return to the step of generating a random number; If the timing duration of the timer reaches the preset duration, the number of composite numbers that have completed the decomposition process within the preset duration is read from the counter.
4. The method according to claim 1, characterized in that The step of determining the computing performance test result of the electronic device based on the number of composite numbers includes: Calculate an average decomposition speed according to the number of composite numbers and the preset time length; Based on the average decomposition speed, an operation performance test result is determined, wherein the operation performance test result is a test score, and the test score is proportional to the average decomposition speed.
5. The method according to claim 1 or 4, characterized in that: After the step of determining the computing performance test result of the electronic device based on the number of composite numbers, the method further includes: The computing performance test result is output to the test interface.
6. A computing performance testing device, characterized in that: The device comprises: A generating module, used for generating a random number according to the performance parameters of the electronic device; A decomposition processing module, used for decomposing the generated random number if it is a composite number; A statistics module is used to count the number of composite numbers that have been decomposed within a preset time period; A determination module, used to determine a test result of the computing performance of the electronic device based on the number of composite numbers; The decomposition processing module is specifically used for taking the random number as the search upper limit, traversing all prime numbers between 2 and the search upper limit, and if the current prime number is divisible by the search upper limit, determining that the current prime number is a prime factor; the quotient value of the search upper limit divided by the current prime number is set as the search upper limit for update, and searching for the prime factor from 2 again, until the search upper limit for update is 1.
7. The device according to claim 6, characterized in that The generation module is specifically used to obtain processor performance parameters; determine a random seed and a random range based on the processor performance parameters; generate a random number based on the random seed; if the generated random number is within the random range, retain the generated random number.
8. The device according to claim 6, characterized in that The device also includes: A start module, used to start the timer and clear the counter when receiving a test start instruction; The statistical module is specifically used to add 1 to the value of the counter after the decomposition process is completed; if the timing duration of the timer does not reach the preset duration, return to execute the step of generating a random number; if the timing duration of the timer reaches the preset duration, read the number of composite numbers that have completed the decomposition process within the preset duration from the counter.
9. The device according to claim 6, characterized in that The determination module is specifically used to calculate an average decomposition speed according to the number of composite numbers and the preset time length; based on the average decomposition speed, determine an operation performance test result, wherein the operation performance test result is a test score, and the test score is proportional to the average decomposition speed.
10. The device according to claim 6 or 9, characterized in that The device also includes: The output module is used to output the computing performance test result to the test interface.
11. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory is used to store a computer program; and the processor is used to implement the method according to any one of claims 1 to 5 when executing the computer program stored in the memory.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
