A method, device, equipment and storage medium for obtaining key delay
By automatically obtaining keyboard key delays, and using key execution modules and keyboard interfaces to calculate delays, the cumbersome manual acquisition problems in the prior art are solved, and efficiency and reliability are improved.
Patent Information
- Application Number
- CN202411150287.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2044-08-21
AI Technical Summary
The process of obtaining delayed keyboard keys is cumbersome, consuming a lot of human resources and time, and is easily affected by human factors, resulting in inefficient acquisition.
By obtaining the sampling parameters of the keyboard target key, using the key execution module and the keyboard interface to obtain the timestamp, calculate the key trigger and release delay, automatically generate the average trigger and release delay, and reduce manual intervention.
Improves the efficiency of keyboard key delay acquisition, reduces acquisition time, and is not affected by human factors, improving reliability.
Smart Images

Figure CN118944650B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method, device, equipment and storage medium for acquiring key delay. Background Art
[0002] Keyboard key delay is crucial for users seeking efficient work, professional competition, or simply enjoying the convenience of technology. Understanding keyboard key delay can help users choose the right keyboard, improving their operating experience.
[0003] However, the existing process of obtaining the keystroke delay of a keyboard is cumbersome and not conducive to improving the efficiency of obtaining the keystroke delay. This is because the existing technology mainly uses manual acquisition to obtain the keyboard keystroke delay. This manual acquisition method consumes a lot of human resources and time resources, increases the acquisition time of the keyboard keystroke delay, and is easily affected by human factors. Therefore, it is not conducive to improving the efficiency of obtaining the keystroke delay. Summary of the Invention
[0004] The present invention provides a key delay acquisition method, device, computer equipment and storage medium to solve the technical problem that the key delay acquisition process of the existing keyboard is cumbersome and is not conducive to improving the key delay acquisition efficiency.
[0005] In a first aspect, a method for obtaining a keystroke delay is provided, which is applied to a computer device, wherein the computer device is connected to a keyboard and a keystroke execution module, respectively. The method for obtaining a keystroke delay comprises:
[0006] Acquire sampling parameters corresponding to a target key of the keyboard, and send the sampling parameters and an execution instruction of the sampling parameters to the key execution module, wherein the execution instruction is used to instruct the key execution module to perform a pressing operation or a releasing operation on the target key according to the sampling parameters;
[0007] Acquire a timestamp of the key execution module executing a pressing operation on the target key, and set the timestamp of the key execution module executing the pressing operation on the target key as the pressing timestamp of the target key;
[0008] Obtaining a timestamp of the key execution module executing a release operation on the target key, and setting the timestamp of the key execution module executing the release operation on the target key as the release timestamp of the target key;
[0009] Obtain a trigger signal of the target key sent by the keyboard, set the receiving time of the trigger signal as the trigger timestamp of the target key, obtain a release signal of the target key sent by the keyboard, set the receiving time of the release signal as the release timestamp of the target key, the trigger signal is the signal when the target key is pressed, and the release signal is the signal when the target key is released;
[0010] Generate a key trigger delay of the target key according to the press timestamp of the target key and the trigger timestamp of the target key, and generate a key release delay of the target key according to the release timestamp of the target key and the release timestamp of the target key;
[0011] Add the different key trigger delays to generate a first sum, divide the first sum by the number of key trigger delays to generate an average trigger delay of the target key, add the different key release delays to generate a second sum, divide the second sum by the number of key release delays to generate an average release delay of the target key.
[0012] Furthermore, the acquiring of the timestamp of the key execution module performing the pressing operation on the target key, and setting the timestamp of the key execution module performing the pressing operation on the target key as the pressing timestamp of the target key, includes:
[0013] receiving a first execution result returned by the key execution module according to the execution instruction;
[0014] In the first execution result, a timestamp of the key execution module performing the pressing operation on the target key is obtained, and the timestamp of the key execution module performing the pressing operation on the target key is set as the pressing timestamp of the target key.
[0015] Furthermore, the acquiring of the timestamp of the release operation performed by the key execution module on the target key, and setting the timestamp of the release operation performed by the key execution module on the target key as the release timestamp of the target key, includes:
[0016] receiving a second execution result returned by the key execution module according to the execution instruction;
[0017] In the second execution result, the timestamp of the release operation performed by the key execution module on the target key is obtained, and the timestamp of the release operation performed by the key execution module on the target key is set as the release timestamp of the target key.
[0018] Furthermore, the acquiring the trigger signal of the target key sent by the keyboard, setting the receiving time of the trigger signal as the trigger timestamp of the target key, acquiring the release signal of the target key sent by the keyboard, and setting the receiving time of the release signal as the release timestamp of the target key, includes:
[0019] Obtaining a trigger signal of the target key sent by the keyboard through a preset keyboard interface, wherein the keyboard interface includes one of a USB interface and a PS / 2 interface;
[0020] The receiving time of the trigger signal is set as the trigger timestamp of the target key, the release signal of the target key sent by the keyboard is obtained, and the receiving time of the release signal is set as the release timestamp of the target key.
[0021] Furthermore, the generating of the key trigger delay of the target key according to the press timestamp of the target key and the trigger timestamp of the target key, and the generating of the key release delay of the target key according to the release timestamp of the target key and the release timestamp of the target key, comprises:
[0022] Generate a key trigger delay of the target key by subtracting the trigger timestamp of the target key from the press timestamp of the target key;
[0023] The key release delay of the target key is generated by subtracting the trigger timestamp of the target key from the press timestamp of the target key.
[0024] Furthermore, the adding of the different key trigger delays to generate a first sum, dividing the first sum by the number of the key trigger delays to generate an average trigger delay of the target key, adding of the different key release delays to generate a second sum, and dividing the second sum by the number of the key release delays to generate an average release delay of the target key includes:
[0025] Obtaining a maximum trigger delay and a minimum trigger delay from among the different key trigger delays, eliminating the maximum trigger delay and the minimum trigger delay from among the different key trigger delays to obtain the filtered key trigger delays, adding the filtered key trigger delays to generate a first sum, and dividing the first sum by the number of the filtered key trigger delays to generate an average trigger delay for the target key;
[0026] A maximum release delay and a minimum release delay among the different key release delays are obtained, and the maximum release delay and the minimum release delay are eliminated from the different key release delays to obtain filtered key release delays. The filtered key release delays are added to generate a second sum, and the second sum is divided by the number of the filtered key release delays to generate an average release delay of the target key.
[0027] Furthermore, after adding the different key trigger delays to generate a first sum, dividing the first sum by the number of key trigger delays to generate an average trigger delay of the target key, adding the different key release delays to generate a second sum, and dividing the second sum by the number of key release delays to generate an average release delay of the target key, the key delay acquisition method includes:
[0028] A preset display window is obtained, and the average trigger delay of the target key and the average trigger delay of the target key are displayed through the display window.
[0029] In a second aspect, a key delay acquisition device is provided, which is applied to a computer device, wherein the computer device is connected to a keyboard and a key execution module respectively, and the key delay acquisition device includes:
[0030] a first acquisition module, configured to acquire sampling parameters corresponding to a target key of the keyboard, and send the sampling parameters and an execution instruction of the sampling parameters to the key execution module, wherein the execution instruction is configured to instruct the key execution module to perform a pressing operation or a releasing operation on the target key according to the sampling parameters;
[0031] a second acquisition module, configured to acquire a timestamp of the key execution module executing a pressing operation on the target key, and set the timestamp of the key execution module executing a pressing operation on the target key as the pressing timestamp of the target key;
[0032] a third acquisition module, configured to acquire a timestamp of when the key execution module performs a release operation on the target key, and set the timestamp when the key execution module performs a release operation on the target key as the release timestamp of the target key;
[0033] a fourth acquisition module, configured to acquire a trigger signal of the target key sent by the keyboard, set the time of receipt of the trigger signal as the trigger timestamp of the target key, acquire a release signal of the target key sent by the keyboard, set the time of receipt of the release signal as the release timestamp of the target key, wherein the trigger signal is a signal when the target key is pressed, and the release signal is a signal when the target key is released;
[0034] a first generating module, configured to generate a key trigger delay of the target key according to a press timestamp of the target key and a trigger timestamp of the target key, and to generate a key release delay of the target key according to a release timestamp of the target key and a release timestamp of the target key;
[0035] The second generation module is used to add the different key trigger delays to generate a first sum, divide the first sum by the number of key trigger delays to generate an average trigger delay of the target key, add the different key release delays to generate a second sum, divide the second sum by the number of key release delays to generate an average release delay of the target key.
[0036] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned key delay acquisition method when executing the computer program.
[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned key delay acquisition method are implemented.
[0038] The present application provides a key delay acquisition method, apparatus, computer equipment and storage medium, which obtain sampling parameters corresponding to a target key of the keyboard, send the sampling parameters and an execution instruction of the sampling parameters to the key execution module, wherein the execution instruction is used to instruct the key execution module to perform a press operation or a release operation on the target key according to the sampling parameters; obtain a timestamp of the key execution module performing the press operation on the target key, and set the timestamp of the key execution module performing the press operation on the target key as the press timestamp of the target key; obtain a timestamp of the key execution module performing the release operation on the target key, and set the timestamp of the key execution module performing the release operation on the target key as the release timestamp of the target key; obtain a trigger signal of the target key sent by the keyboard, and set the receiving time of the trigger signal as the trigger timestamp of the target key; obtain a release signal of the target key sent by the keyboard, and set the receiving time of the release signal as the release timestamp of the target key, wherein the trigger signal is a signal of the target key when it is pressed, and the release signal is a signal of the target key when it is released; according to the press timestamp of the target key The method comprises the following steps: first, adding the different key trigger delays to generate a first sum, dividing the first sum by the number of key trigger delays, and generating an average trigger delay of the target key; second, adding the different key release delays to generate a second sum, and dividing the second sum by the number of key release delays to generate an average release delay of the target key; and third, adding the different key trigger delays to generate a first sum, dividing the first sum by the number of key trigger delays, and generating an average release delay of the target key. The method has two beneficial effects: on the one hand, adding the different key release delays to generate a second sum, dividing the first sum by the number of key trigger delays, and generating an average release delay of the target key. Since manual acquisition is not required, the acquisition time of the keyboard key delay is reduced, which is conducive to improving the efficiency of keyboard key delay acquisition; and on the other hand, it is not affected by human factors, which is conducive to improving the reliability of the acquired keyboard key delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0040] Figure 1 This is a schematic diagram of an application environment of a key delay acquisition method according to an embodiment of the present invention;
[0041] Figure 2 A schematic flow chart of a method for obtaining key delay provided by an embodiment of the present invention;
[0042] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S23;
[0043] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step S25;
[0044] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S26;
[0045] Figure 6 This is a structural diagram of a key delay acquisition device according to an embodiment of the present invention;
[0046] Figure 7 is a structural diagram of a computer device in one embodiment of the present invention;
[0047] Figure 8 FIG. 2 is another structural diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0049] See also Figure 1 , Figure 1 Schematic diagram of an application environment of a key delay acquisition method according to an embodiment of the present invention. The key delay acquisition method provided by the embodiment of the present invention can be applied in the following situations: Figure 1 In an application environment, the computer device is connected to a keyboard and a key execution module respectively.
[0050] For ease of explanation, the following examples are given:
[0051] For example, the keyboard is a wired magnetic keyboard, and the computer device is a PC host;
[0052] Among them, the PC host is the host of a personal computer (Personal Computer).
[0053] The magnetic axis keyboard and key execution module are connected to the PC host. The key execution module indicator light is red, indicating that the device is connected to the PC host;
[0054] Set on the PC host: test times 3, test interval 5S, sampling times 300, sampling interval 20ms.
[0055] After the setting is completed, the acquisition parameters will be sent to the key execution module.
[0056] When the sampling interval is 20ms, the sampling frequency is 50Hz.
[0057] After the test starts, the key execution module samples the target key on the magnetic axis keyboard 300 times at a frequency of 50Hz, with pressing and releasing as one sampling. A total of 3 rounds of testing are performed, with an interval of 5S between each round. At the same time, the indicator light flashes green at a frequency of 50Hz. Each sampling PC host will collect a set of T W0 、T W1 , T0, T1, and then obtain a set of ΔT0, ΔT1.
[0058] Where ΔT0=T W0 -T0, ΔT1=T W1 -T1;
[0059] Among them, T W0 is the target key press timestamp, T W1 The release timestamp of the target key;
[0060] Wherein, T0 is the trigger timestamp of the target key, and T1 is the release timestamp of the target key;
[0061] Wherein, ΔT0 is the key triggering delay of the target key, and ΔT1 is the key releasing delay of the target key.
[0062] After the acquisition is completed, the indicator light turns green for 5 seconds. At the same time, the host computer software processes the 300*3 groups of key delay data to obtain the average trigger delay and average release delay, and displays the results.
[0063] Among them, manufacturers, enthusiasts, and bloggers can use the above-mentioned key delay acquisition method to test existing keyboards, thereby meeting the usage needs of different user groups.
[0064] In the scheme implemented by the above-mentioned key delay acquisition method, device, equipment and medium, the beneficial effects are in two aspects. On the one hand, the different key trigger delays are added to generate a first sum, and the first sum is divided by the number of the key trigger delays to generate the average trigger delay of the target key. The different key release delays are added to generate a second sum, and the second sum is divided by the number of the key release delays to generate the average release delay of the target key. Since manual acquisition is not required, the acquisition time of the keyboard key delay is reduced, which is conducive to improving the efficiency of acquiring the keyboard key delay; on the other hand, it will not be affected by human factors, so it is conducive to improving the reliability of the acquired keyboard key delay.
[0065] The client may include but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0066] The server can be implemented with an independent task database or a task database cluster composed of multiple task databases. The present invention will be described in detail below through specific embodiments.
[0067] See also Figure 2 , Figure 2 A flowchart of a method for obtaining a keystroke delay according to an embodiment of the present invention is provided. The method is applied to a computer device, wherein the computer device is connected to a keyboard and a keystroke execution module. The method comprises the following steps:
[0068] S21, obtaining sampling parameters corresponding to a target key on the keyboard, and sending the sampling parameters and an execution instruction of the sampling parameters to the key execution module, wherein the execution instruction is used to instruct the key execution module to perform a pressing operation or a releasing operation on the target key according to the sampling parameters;
[0069] Exemplarily, the sampling parameters include the number of tests, the test interval, the number of samples, and the sampling interval. The number of tests refers to the total number of tests, the test interval refers to the time difference between two adjacent tests, the number of samples refers to the total number of samples in one test, and the test interval refers to the time difference between two adjacent samples.
[0070] For ease of explanation, the following example is used to set the sampling parameters through the host computer. The sampling parameters include the number of tests, test interval, number of samples, and sampling interval. The set sampling parameters will be sent to the key execution module.
[0071] The execution instructions are user-defined or system-default, and are not restricted here.
[0072] Among them, the data packet for executing instructions includes a header part, an ACK part, and a data part.
[0073] Among them, the packet header includes head, len, cmd, and crc.
[0074] Among them, the full Chinese name of head is: Head; the full English name of head is: Header.
[0075] Among them, the Chinese full name of len: length; the English full name of len: Length.
[0076] Among them, the Chinese full name of cmd is: command; the English full name of cmd is: Command.
[0077] Among them, the Chinese full name of crc: cyclic redundancy check, and the English full name of crc: Cyclic Redundancy Check.
[0078] For ease of explanation, the following examples are given:
[0079] head: indicates the starting byte of the data packet. For example, head is 0x5C.
[0080] len: indicates the length of the data part.
[0081] cmd: indicates the command type, which includes write command 0x01, read command 0x02, start test command 0x03, physical trigger command 0x04, and physical release command 0x05.
[0082] crc: indicates the checksum of the data part.
[0083] ACK: Indicates the status of the response command. ack=0x01 indicates successful receipt of the other party's command, and ack=0x00 indicates failure to receive the other party's command.
[0084] Data part: instruction data, such as 0x0000 represents physical trigger, and the timestamp of physical trigger is the timestamp when the key execution module performs the pressing operation on the target key; such as 0xFFFF represents physical release, and the timestamp of physical release is the timestamp when the key execution module performs the releasing operation on the target key.
[0085] S22, obtaining a timestamp of the key execution module executing a pressing operation on the target key, and setting the timestamp of the key execution module executing a pressing operation on the target key as the pressing timestamp of the target key;
[0086] The acquiring of the timestamp of the key execution module executing the pressing operation on the target key, and setting the timestamp of the key execution module executing the pressing operation on the target key as the pressing timestamp of the target key, includes:
[0087] receiving a first execution result returned by the key execution module according to the execution instruction;
[0088] In the first execution result, a timestamp of the key execution module performing the pressing operation on the target key is obtained, and the timestamp of the key execution module performing the pressing operation on the target key is set as the pressing timestamp of the target key.
[0089] S23, obtaining a timestamp of the key execution module performing a release operation on the target key, and setting the timestamp of the key execution module performing a release operation on the target key as the release timestamp of the target key;
[0090] S24, obtaining a trigger signal of the target key sent by the keyboard, setting the receiving time of the trigger signal as the trigger timestamp of the target key, obtaining a release signal of the target key sent by the keyboard, setting the receiving time of the release signal as the release timestamp of the target key, wherein the trigger signal is a signal when the target key is pressed, and the release signal is a signal when the target key is released;
[0091] When the target key is pressed, the keyboard circuit detects a pressing action on the target key, thereby generating a signal indicating that the target key is pressed.
[0092] When the target key is released, the circuit of the keyboard will detect a release action for the target key, thereby generating a signal indicating that the target key is released.
[0093] The acquiring of the trigger signal of the target key sent by the keyboard, setting the receiving time of the trigger signal as the trigger timestamp of the target key, acquiring the release signal of the target key sent by the keyboard, and setting the receiving time of the release signal as the release timestamp of the target key include:
[0094] Obtaining a trigger signal of the target key sent by the keyboard through a preset keyboard interface, wherein the keyboard interface includes one of a USB interface and a PS / 2 interface;
[0095] The receiving time of the trigger signal is set as the trigger timestamp of the target key, the release signal of the target key sent by the keyboard is obtained, and the receiving time of the release signal is set as the release timestamp of the target key.
[0096] The USB interface is a USB (Universal Serial Bus) interface.
[0097] The PS / 2 interface is a circular, 6-pin mini-DIN interface used to connect a keyboard and mouse. The PS / 2 communication protocol is a bidirectional synchronous serial communication protocol with pin definitions such as clock and data lines.
[0098] S25, generating a key trigger delay of the target key according to the press timestamp of the target key and the trigger timestamp of the target key, and generating a key release delay of the target key according to the release timestamp of the target key and the release timestamp of the target key;
[0099] S26, adding the different key trigger delays to generate a first sum, dividing the first sum by the number of key trigger delays to generate an average trigger delay of the target key, adding the different key release delays to generate a second sum, dividing the second sum by the number of key release delays to generate an average release delay of the target key.
[0100] The number of key trigger delays is the number of samples of the key trigger delay.
[0101] The number of key release delays is the number of samples of the key release delay.
[0102] For ease of explanation, the following examples are given:
[0103] For example, if the sampling rate is 50 times per second, the number of samples of the key trigger delay within 6 seconds is 300, so the number of key trigger delays is 300. Similarly, if the sampling rate is 50 times per second, the number of samples of the key release delay within 6 seconds is 300, so the number of key release delays is 300.
[0104] For example, if the sampling rate is 100 times per second, the number of samples of the key trigger delay within 8 seconds is 800, so the number of key trigger delays is 800. Similarly, if the sampling rate is 100 times per second, the number of samples of the key release delay within 8 seconds is 800, so the number of key release delays is 800.
[0105] The method for obtaining key delays includes: adding the different key trigger delays to generate a first sum, dividing the first sum by the number of key trigger delays to generate an average trigger delay of the target key, adding the different key release delays to generate a second sum, and dividing the second sum by the number of key release delays to generate an average release delay of the target key.
[0106] Step A: obtaining a preset display window, and displaying the average trigger delay of the target key and the average trigger delay of the target key through the display window.
[0107] Exemplarily, after adding the different key trigger delays to generate a first sum, dividing the first sum by the number of key trigger delays to generate an average trigger delay of the target key, adding the different key release delays to generate a second sum, and dividing the second sum by the number of key release delays to generate the average release delay of the target key, the key delay acquisition method includes:
[0108] Step B: adding the average trigger delays of different target keys to generate a third sum, dividing the third sum by the number of target keys to generate an overall trigger delay of the keyboard, adding the average release delays of different target keys to generate a fourth sum, and dividing the third sum by the number of target keys to generate an overall release delay of the keyboard;
[0109] Obtaining a first ratio between the overall trigger delay and the preset trigger delay, obtaining a second ratio between the overall release delay and the preset trigger delay, and adding the first ratio and the second ratio to generate an overall delay value;
[0110] When the overall delay value is less than a preset value, a message indicating that the keyboard test has passed is output; and when the overall delay value is greater than or equal to the preset value, a message indicating that the keyboard test has failed is output.
[0111] Among them, the overall trigger delay is used to describe the delay degree of the keyboard in terms of trigger delay. When the overall trigger delay is larger, the delay degree of the keyboard in terms of trigger delay is larger. When the overall trigger delay is smaller, the delay degree of the keyboard in terms of trigger delay is smaller.
[0112] The overall release delay is used to describe the degree of delay of the keyboard in terms of release delay. When the overall release delay is greater, the degree of delay of the keyboard in terms of release delay is greater; when the overall release delay is smaller, the degree of delay of the keyboard in terms of release delay is smaller.
[0113] Among them, the overall delay value is used to describe the delay degree of the keyboard in terms of trigger delay and release delay. When the overall delay value is larger, the delay degree of the keyboard in terms of trigger delay and release delay is greater. When the overall delay value is smaller, the delay degree of the keyboard in terms of trigger delay and release delay is smaller.
[0114] Wherein, the target key is any key on the keyboard.
[0115] Among them, the different target keys are user-set or system default.
[0116] For ease of explanation, the following examples are given:
[0117] For example, when the different target keys are the W key, the A key, the S key, and the D key, adding the average trigger delays of the different target keys to generate a third sum, dividing the third sum by the number of target keys to generate the overall trigger delay of the keyboard, adding the average release delays of the different target keys to generate a fourth sum, and dividing the third sum by the number of target keys to generate the overall release delay of the keyboard includes:
[0118] Add up the average trigger delays of the W key, A key, S key, and D key to generate a third sum, divide the third sum by the number of target keys to generate the overall trigger delay of the keyboard, add up the average release delays of the W key, A key, S key, and D key to generate a fourth sum, divide the third sum by the number of target keys to generate the overall release delay of the keyboard.
[0119] In an embodiment of the present invention, the beneficial effects are in two aspects. On the one hand, the different key trigger delays are added together to generate a first sum, and the first sum is divided by the number of the key trigger delays to generate the average trigger delay of the target key. The different key release delays are added together to generate a second sum, and the second sum is divided by the number of the key release delays to generate the average release delay of the target key. Since manual acquisition is not required, the acquisition time of the keyboard key delay is reduced, which is beneficial to improving the acquisition efficiency of the keyboard key delay. On the other hand, it will not be affected by human factors, so it is beneficial to improve the reliability of the acquired keyboard key delay.
[0120] See also Figure 3 , Figure 3 yes Figure 1 A specific implementation flow diagram of step S23 is described in detail as follows:
[0121] S31, receiving a second execution result returned by the key execution module according to the execution instruction;
[0122] S32: In the second execution result, obtain the timestamp of the key execution module performing the release operation on the target key, and set the timestamp of the key execution module performing the release operation on the target key as the release timestamp of the target key.
[0123] In the embodiment of the present invention, the time point when the target key is released can be determined by the release timestamp.
[0124] See also Figure 4 , Figure 4 yes Figure 1 A specific implementation flow diagram of step S25 is described in detail as follows:
[0125] S41, generating a key trigger delay of the target key by subtracting a trigger timestamp of the target key from a press timestamp of the target key;
[0126] S42: Generate a key release delay of the target key by subtracting the trigger timestamp of the target key from the press timestamp of the target key.
[0127] In the embodiment of the present invention, the delay degree of the target key can be determined according to the key trigger delay and the key release delay.
[0128] See also Figure 5 , Figure 5 yes Figure 1 A specific implementation flow diagram of step S26 is described in detail as follows:
[0129] S51, obtaining a maximum trigger delay and a minimum trigger delay among the different key trigger delays, eliminating the maximum trigger delay and the minimum trigger delay from the different key trigger delays to obtain the filtered key trigger delays, adding the filtered key trigger delays to generate a first sum, and dividing the first sum by the number of the filtered key trigger delays to generate an average trigger delay of the target key;
[0130] S52: Obtain a maximum release delay and a minimum release delay from among the different key release delays, remove the maximum release delay and the minimum release delay from among the different key release delays to obtain filtered key release delays, add the filtered key release delays to generate a second sum, and divide the second sum by the number of filtered key release delays to generate an average release delay of the target key.
[0131] In the embodiment of the present invention, since manual acquisition is not required, the acquisition time of the keyboard key delay is reduced, which is conducive to improving the acquisition efficiency of the keyboard key delay.
[0132] See also Figure 6 , Figure 6 1 is a structural diagram of a key delay acquisition device according to an embodiment of the present invention. The key delay acquisition device is applied to a computer device, wherein the computer device is connected to a keyboard and a key execution module, such as Figure 6 As shown, the key delay acquisition device includes a first acquisition module 101, a second acquisition module 102, a third acquisition module 103, a fourth acquisition module 104, a first generation module 105, and a second generation module 106. The functional modules are described in detail as follows:
[0133] A first acquisition module 101 is configured to acquire sampling parameters corresponding to a target key on the keyboard, and send the sampling parameters and an execution instruction of the sampling parameters to the key execution module, wherein the execution instruction is configured to instruct the key execution module to execute a press operation or a release operation on the target key according to the sampling parameters;
[0134] A second acquisition module 102 is configured to acquire a timestamp of a key execution module executing a pressing operation on the target key, and set the timestamp of a key execution module executing a pressing operation on the target key as a pressing timestamp of the target key;
[0135] A third acquisition module 103 is configured to acquire a timestamp of when the key execution module performs a release operation on the target key, and set the timestamp when the key execution module performs a release operation on the target key as the release timestamp of the target key;
[0136] a fourth acquisition module 104, configured to acquire a trigger signal of the target key sent by the keyboard, set the time of receipt of the trigger signal as the trigger timestamp of the target key, acquire a release signal of the target key sent by the keyboard, set the time of receipt of the release signal as the release timestamp of the target key, wherein the trigger signal is a signal when the target key is pressed, and the release signal is a signal when the target key is released;
[0137] A first generating module 105 is configured to generate a key trigger delay of the target key according to a press timestamp of the target key and a trigger timestamp of the target key, and to generate a key release delay of the target key according to a release timestamp of the target key and a release timestamp of the target key;
[0138] The second generation module 106 is used to add the different key trigger delays to generate a first sum, divide the first sum by the number of key trigger delays to generate an average trigger delay of the target key, add the different key release delays to generate a second sum, divide the second sum by the number of key release delays to generate an average release delay of the target key.
[0139] In an embodiment of the present invention, the beneficial effects are in two aspects. On the one hand, the different key trigger delays are added together to generate a first sum, and the first sum is divided by the number of the key trigger delays to generate the average trigger delay of the target key. The different key release delays are added together to generate a second sum, and the second sum is divided by the number of the key release delays to generate the average release delay of the target key. Since manual acquisition is not required, the acquisition time of the keyboard key delay is reduced, which is beneficial to improving the acquisition efficiency of the keyboard key delay. On the other hand, it will not be affected by human factors, so it is beneficial to improve the reliability of the acquired keyboard key delay.
[0140] The specific definition of the key delay acquisition device can be found in the above definition of the key delay acquisition method, which will not be repeated here.
[0141] Each module in the aforementioned key delay acquisition device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0142] See also Figure 7 , Figure 7 This is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected via a system bus.
[0143] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When executed by the processor, the computer program implements the functions or steps on the server side of a key delay acquisition method.
[0144] See also Figure 8 , Figure 8 This is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external task database via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a key delay acquisition method.
[0145] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor.
[0146] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can be found in the relevant descriptions of the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0147] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0148] The flowcharts and block diagrams in the accompanying drawings show the possible implementation architectures, functions and operations of the systems, methods and computer program products according to the embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment or part of the code, and the module, program segment or part of the code contains one or more executable instructions for implementing the specified logical functions. In some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, or they can sometimes be executed in the opposite order, which can depend on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in an order different from that disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, or they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified function or action, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for obtaining key delay, characterized in that: Applied to a computer device, the computer device is connected to a keyboard and a key execution module respectively, and the key delay acquisition method includes: Acquire sampling parameters corresponding to a target key of the keyboard, and send the sampling parameters and an execution instruction of the sampling parameters to the key execution module, wherein the execution instruction is used to instruct the key execution module to perform a pressing operation or a releasing operation on the target key according to the sampling parameters; Acquire a timestamp of the key execution module executing a pressing operation on the target key, and set the timestamp of the key execution module executing the pressing operation on the target key as the pressing timestamp of the target key; Obtaining a timestamp of the key execution module executing a release operation on the target key, and setting the timestamp of the key execution module executing the release operation on the target key as the release timestamp of the target key; Obtain a trigger signal of the target key sent by the keyboard, set the receiving time of the trigger signal as the trigger timestamp of the target key, obtain a release signal of the target key sent by the keyboard, set the receiving time of the release signal as the release timestamp of the target key, the trigger signal is the signal when the target key is pressed, and the release signal is the signal when the target key is released; Generate a key trigger delay of the target key according to the press timestamp of the target key and the trigger timestamp of the target key, and generate a key release delay of the target key according to the release timestamp of the target key and the release timestamp of the target key; Add the different key trigger delays to generate a first sum, divide the first sum by the number of key trigger delays to generate an average trigger delay of the target key, add the different key release delays to generate a second sum, divide the second sum by the number of key release delays to generate an average release delay of the target key.
2. The key delay acquisition method according to claim 1, characterized in that: The acquiring the timestamp of the key execution module executing the pressing operation on the target key, and setting the timestamp of the key execution module executing the pressing operation on the target key as the pressing timestamp of the target key, includes: receiving a first execution result returned by the key execution module according to the execution instruction; In the first execution result, a timestamp of the key execution module performing the pressing operation on the target key is obtained, and the timestamp of the key execution module performing the pressing operation on the target key is set as the pressing timestamp of the target key.
3. The key delay acquisition method according to claim 1, characterized in that: The acquiring the timestamp of the release operation performed by the key execution module on the target key, and setting the timestamp of the release operation performed by the key execution module on the target key as the release timestamp of the target key, includes: receiving a second execution result returned by the key execution module according to the execution instruction; In the second execution result, the timestamp of the release operation performed by the key execution module on the target key is obtained, and the timestamp of the release operation performed by the key execution module on the target key is set as the release timestamp of the target key.
4. The key delay acquisition method according to claim 1, characterized in that: The acquiring the trigger signal of the target key sent by the keyboard, setting the receiving time of the trigger signal as the trigger timestamp of the target key, acquiring the release signal of the target key sent by the keyboard, and setting the receiving time of the release signal as the release timestamp of the target key, includes: Obtaining a trigger signal of the target key sent by the keyboard through a preset keyboard interface, wherein the keyboard interface includes one of a USB interface and a PS / 2 interface; The receiving time of the trigger signal is set as the trigger timestamp of the target key, the release signal of the target key sent by the keyboard is obtained, and the receiving time of the release signal is set as the release timestamp of the target key.
5. The key delay acquisition method according to claim 1, characterized in that: The step of generating a key trigger delay of the target key according to the press timestamp of the target key and the trigger timestamp of the target key, and generating a key release delay of the target key according to the release timestamp of the target key and the release timestamp of the target key, comprises: Generate a key trigger delay of the target key by subtracting the trigger timestamp of the target key from the press timestamp of the target key; The key release delay of the target key is generated by subtracting the trigger timestamp of the target key from the press timestamp of the target key.
6. The key delay acquisition method according to claim 1, characterized in that: The adding of the different key trigger delays to generate a first sum, dividing the first sum by the number of the key trigger delays to generate an average trigger delay of the target key, adding of the different key release delays to generate a second sum, and dividing the second sum by the number of the key release delays to generate an average release delay of the target key includes: Obtaining a maximum trigger delay and a minimum trigger delay from among the different key trigger delays, eliminating the maximum trigger delay and the minimum trigger delay from among the different key trigger delays to obtain the filtered key trigger delays, adding the filtered key trigger delays to generate a first sum, and dividing the first sum by the number of the filtered key trigger delays to generate an average trigger delay for the target key; A maximum release delay and a minimum release delay among the different key release delays are obtained, and the maximum release delay and the minimum release delay are eliminated from the different key release delays to obtain filtered key release delays. The filtered key release delays are added to generate a second sum, and the second sum is divided by the number of the filtered key release delays to generate an average release delay of the target key.
7. The key delay acquisition method according to any one of claims 1 to 6, characterized in that: After adding the different key trigger delays to generate a first sum, dividing the first sum by the number of key trigger delays to generate an average trigger delay of the target key, adding the different key release delays to generate a second sum, and dividing the second sum by the number of key release delays to generate an average release delay of the target key, the key delay acquisition method includes: A preset display window is obtained, and the average trigger delay of the target key and the average trigger delay of the target key are displayed through the display window.
8. A key delay acquisition device, characterized in that: Applied to a computer device, the computer device is connected to a keyboard and a key execution module respectively, and the key delay acquisition device includes: a first acquisition module, configured to acquire sampling parameters corresponding to a target key of the keyboard, and send the sampling parameters and an execution instruction of the sampling parameters to the key execution module, wherein the execution instruction is configured to instruct the key execution module to perform a pressing operation or a releasing operation on the target key according to the sampling parameters; a second acquisition module, configured to acquire a timestamp of the key execution module executing a pressing operation on the target key, and set the timestamp of the key execution module executing a pressing operation on the target key as the pressing timestamp of the target key; a third acquisition module, configured to acquire a timestamp of when the key execution module performs a release operation on the target key, and set the timestamp when the key execution module performs a release operation on the target key as the release timestamp of the target key; a fourth acquisition module, configured to acquire a trigger signal of the target key sent by the keyboard, set the time of receipt of the trigger signal as the trigger timestamp of the target key, acquire a release signal of the target key sent by the keyboard, set the time of receipt of the release signal as the release timestamp of the target key, wherein the trigger signal is a signal when the target key is pressed, and the release signal is a signal when the target key is released; a first generating module, configured to generate a key trigger delay of the target key according to a press timestamp of the target key and a trigger timestamp of the target key, and to generate a key release delay of the target key according to a release timestamp of the target key and a release timestamp of the target key; The second generation module is used to add the different key trigger delays to generate a first sum, divide the first sum by the number of key trigger delays to generate an average trigger delay of the target key, add the different key release delays to generate a second sum, divide the second sum by the number of key release delays to generate an average release delay of the target key.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the key delay acquisition method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the key delay acquisition method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Speed adjustable USB keyboard
CN103838387A
Key event processing method and device, equipment and storage medium
CN112882850A