Method and device for acquiring browser running data, and electronic equipment
By receiving event-triggered requests, binding events to event monitoring functions, and obtaining browser response times, the problem of browser performance measurement relying on a single data point is solved, enabling more accurate and comprehensive performance monitoring and reducing memory leaks.
Patent Information
- Application Number
- CN202111248539.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-26
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2041-10-26
AI Technical Summary
In existing technologies, browser performance measurement relies on a single load speed metric, which makes it impossible to accurately determine browser performance.
By receiving event trigger requests, binding the events to be executed with preset event monitoring functions, obtaining the event response duration, determining the browser's response duration using time intervals, preventing memory leaks, and uploading response duration distribution characteristics.
It improves the accuracy and comprehensiveness of browser performance monitoring, reduces the risk of memory leaks, and simplifies the ease of use of browser performance analysis.
Smart Images

Figure CN114117289B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of data processing, in particular to the fields of big data, information flow, cloud service, and the like, and specifically relates to a browser running data acquisition method and device and electronic equipment. BACKGROUND
[0002] With the development of computer technology and Internet technology, people have higher and higher requirements for the performance of Internet products. In the related art, the performance of a browser is usually measured based on the loading speed of the browser. However, this way of measuring the performance of the browser is based on single running data, and therefore, how to accurately determine the performance of the browser is a problem to be solved. SUMMARY
[0003] The present disclosure provides a browser running data acquisition method and device.
[0004] According to an aspect of the present disclosure, a browser running data acquisition method is provided, comprising:
[0005] receiving an event triggering request, wherein the triggering request includes an event to be executed and a first time corresponding to the triggering request;
[0006] in a case where the event to be executed is bound to a callback function, binding the event to be executed to a preset event monitoring function;
[0007] acquiring a second time at which the event monitoring function is executed;
[0008] determining a response duration of the browser under the event to be executed according to a time interval between the second time and the first time.
[0009] According to another aspect of the present disclosure, a browser running data acquisition device is provided, comprising:
[0010] a receiving module configured to receive an event triggering request, wherein the triggering request includes an event to be executed and a first time corresponding to the triggering request;
[0011] a binding module configured to, in a case where the event to be executed is bound to a callback function, bind the event to be executed to a preset event monitoring function;
[0012] an acquisition module configured to acquire a second time at which the event monitoring function is executed;
[0013] a first determining module configured to determine a response duration of the browser under the event to be executed according to a time interval between the second time and the first time.
[0014] According to another aspect of the present disclosure, an electronic device is provided, comprising:
[0015] at least one processor; and
[0016] a memory connected with the at least one processor in communication; wherein
[0017] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the above embodiments.
[0018] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method described in the above embodiments.
[0019] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method described in the above embodiments.
[0020] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0021] The accompanying drawings are used to better understand the present scheme, and do not limit the present disclosure. Among them:
[0022] Figure 1 A flowchart of a browser running data acquisition method provided by an embodiment of the present disclosure is shown;
[0023] Figure 2 A page running data acquisition process diagram provided by an embodiment of the present disclosure is shown;
[0024] Figure 3 A flowchart of another browser running data acquisition method provided by an embodiment of the present disclosure is shown;
[0025] Figure 4 A flowchart of another browser running data acquisition method provided by an embodiment of the present disclosure is shown;
[0026] Figure 5 A flowchart of another browser running data acquisition device provided by an embodiment of the present disclosure is shown;
[0027] Figure 6 A block diagram of an electronic device for implementing a browser running data acquisition method according to an embodiment of the present disclosure is shown; DETAILED DESCRIPTION
[0028] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are cited as illustrative examples. Therefore, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of known functions and constructions are omitted for clarity and conciseness.
[0029] The method, device, electronic device and storage medium for acquiring browser running data according to the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0030] Figure 1 A flowchart of a method for acquiring browser running data according to an embodiment of the present disclosure is shown in FIG. 1.
[0031] As shown in FIG. 1, the method includes the following steps. Figure 1
[0032] Step 101: receiving an event triggering request, wherein the triggering request includes an event to be executed and a first time corresponding to the triggering request.
[0033] The event to be executed can be an event triggered by a user when the user manipulates a browser page. For example, for a Web application, representative events include a single-click event, a double-click event, a mouse movement event, and the like. The first time can be a time point of the request triggering.
[0034] In the present disclosure, the event to be executed can be triggered by a keyboard input, a mouse click, or the like on the browser client side, and then the browser client side can acquire a timestamp of the triggering time as the first time corresponding to the triggering request and determine the triggered event as the event to be executed.
[0035] For example, a click event request corresponding to an "open" button in an advertisement window on a browser page can be triggered by clicking the "open" button with a mouse, and the browser client side can acquire a timestamp of the time as the first time corresponding to the triggering request when receiving the request and determine the click event as the event to be executed.
[0036] Step 102: in a case where the event to be executed is bound to a callback function, binding the event to be executed to a preset event monitoring function.
[0037] The callback function can be a program code for implementing the event to be executed. Generally, different page events in a browser need to be bound to corresponding callback functions, and the page events can be completed by executing the callback functions.
[0038] In addition, the preset event monitoring function can only have the function of obtaining a timestamp, and is used to monitor the end time of each callback function of the browser running. In the disclosure, when it is determined that the event to be executed is bound to the callback function, the event can be bound to the preset event monitoring function, so that the end time of the execution of each event can be obtained.
[0039] In the disclosure, during the page loading process, the callback functions corresponding to each page element can be determined by parsing the page script, and then the callback function binding can be performed by calling the event binding API. When the callback function is bound, the binding of the event monitoring function and the event can be completed by calling the event binding API again. Alternatively, the binding of the monitoring function and the event to be executed can be completed by calling the event binding API again when the event is triggered.
[0040] It can be understood that the event to be executed can be bound to multiple callback functions, and the callback function bound in the innermost layer can be a callback function corresponding to a business function (hereinafter referred to as a business callback function), and the callback function bound in the outermost layer can be an event monitoring function, which is used to obtain the completion time of the event to be executed.
[0041] In step 103, a second time of executing the event monitoring function is obtained.
[0042] In the disclosure, the second time of executing the event monitoring function, i.e., the end time of the business callback function, can be obtained by using the event monitoring function.
[0043] In the disclosure, when any event is triggered, the browser client can execute the callback functions in sequence according to the order of the callback functions bound to the event, to complete the event.
[0044] It should be noted that when the browser main thread is in an idle state, any event can be executed immediately according to the binding order of the corresponding callback functions. When the browser main thread has other tasks to be executed, the event to be executed can be added to the execution stack, and then each task in the execution stack can be executed in sequence. When the event to be executed is executed, each callback function can be executed in sequence according to the binding order of the corresponding callback functions, to obtain the second time of executing the event monitoring function.
[0045] For example, Figure 2 A page running data acquisition process schematic diagram provided by the disclosure is provided. As shown in Figure 2As shown, when there are two tasks waiting to be executed in the stack, if the click event occurs during the execution of task 1, the browser can first complete the execution of task 1, then execute task 2 in the stack, then execute the business callback function bound to the click event, and then execute the event monitoring function to obtain the timestamp of the execution of the event monitoring function, i.e., the second moment.
[0046] Step 104: Determine the browser's response time for the event to be executed based on the time interval between the second and first moments.
[0047] In this disclosure, the time difference between the second moment and the first moment can be determined, and then this time difference can be used as the response time of the browser under the event to be executed.
[0048] For example, such as Figure 2 As shown, when a click event occurs during Task 1 in the execution stack, the browser's response time to the click event can be the time difference between the moment the click event is triggered (i.e., the first moment) and the moment the business callback function finishes executing. Since the event detection function takes a very short time, it can be ignored. The second moment of executing the event detection function can be determined as the moment the business callback function finishes executing. Therefore, the browser's response time to the click event can also be the time difference between the first moment and the second moment.
[0049] In this disclosure, upon receiving an event trigger request, and after determining that the event to be executed is bound to a callback function, the event to be executed is bound to a preset event monitoring function. Then, after obtaining the second moment of the event monitoring function's execution, the browser's response time for the event to be executed can be determined based on the time interval between the second moment and the first moment. Therefore, by binding the event to be executed to the event monitoring function, the accuracy of monitoring the execution time of various page events is improved, thereby enhancing the accuracy of browser performance monitoring. By monitoring the event to be executed, the scenarios for browser monitoring are increased, thus increasing the comprehensiveness of browser performance monitoring.
[0050] In practical applications, there are often many pages that use front-end elements and switch routes, all implemented within the same page without involving page navigation. When the same page element can be triggered multiple times to trigger different events, if the event monitoring functions registered for each event are not cleared, there is a risk of memory leaks. Therefore, after binding events to event monitoring functions, event monitoring functions can be deleted as needed. The following section combines... Figure 3 The above process will be explained in detail. Figure 3 Another method for obtaining browser runtime data is provided in this embodiment of the disclosure.
[0051] likeFigure 3 The method comprises the following steps of:
[0052] In step 301, an event triggering request is received, wherein the triggering request comprises an event to be executed and a first time corresponding to the triggering request.
[0053] In this embodiment, the specific implementation process of step 301 can refer to the detailed description of the above-mentioned embodiments, which will not be described here again.
[0054] In step 302, in a case where the event to be executed is a valid event, a target callback function to be bound is determined according to the type of the event to be executed.
[0055] The valid event can be any event that can cause the content of a page to change. For example, after a “login” button in a page is clicked, a verification window pops up on the page, and the click event is a valid event.
[0056] It can be understood that the callback functions corresponding to events of the same type can be the same, for example, the mouse move-out events corresponding to all page elements can be applied to a callback function for implementing a default setting recovery function. Alternatively, the callback functions corresponding to events of the same type can also be different, for example, the mouse click events of a “back” button can be applied to a callback function for implementing a window closing function, the mouse click events of a “confirm” button can be applied to a callback function for implementing a data submission function, and the like. It should be noted that the above-mentioned correspondence between events and callback functions is only illustrative and cannot be regarded as a limitation on the technical solutions in the present disclosure.
[0057] In this embodiment, whether each event corresponding to each page element is a valid event can be identified in the form of a comment in a HyperText Markup Language (html) code file of a browser, and then the comment information corresponding to the event is parsed in the process of loading the browser page to determine whether the event is a valid event. In a case where the event to be executed is a valid event, when the callback functions corresponding to events of the same type are the same, the target callback function can be determined according to the type of the event to be executed, and when the callback functions corresponding to events of the same type can be different, the target callback function can be determined according to the function of the page element associated with the event to be executed, and the present disclosure does not make any limitation thereon.
[0058] In the present disclosure, in a case where the event to be executed is a valid event, the target callback function to be bound can be determined according to the type of the event to be executed, so that the needs of various scenarios can be met.
[0059] In step 303, the event to be executed is bound to the target callback function.
[0060] In this embodiment, the specific implementation process of step 303 can refer to the detailed description of the above embodiment, which will not be repeated here.
[0061] In step 304, functions currently bound by the page element associated with the event to be executed are determined.
[0062] In actual application, if the same page element can be triggered multiple times to generate different events, the page element can be registered with multiple event monitoring functions, thereby causing memory leakage.
[0063] For example, there is a button in the current page, after the button is clicked for the first time, a popup window will be opened, and the function of the button changes from "open" to "close", the click event corresponding to the button is bound with a first event monitoring function, and then when the button is clicked again, the popup window will be closed, the click event corresponding to the button is bound with a second event monitoring function. With the increase in the number of clicks on the button, the click event corresponding to the button will be bound with more event monitoring functions. Therefore, the event monitoring functions bound by the event can be deleted to prevent memory leakage.
[0064] In step 305, the event monitoring function bound by the event is removed in the case that the event monitoring function is included in the bound functions.
[0065] In this embodiment, it can be queried whether there is an event monitoring function in the function information bound by the page element, and if there is an event monitoring function, all event monitoring functions registered by the page element are deleted, for example, the event unbinding API can be called to unbind the event monitoring functions bound by the event.
[0066] For example, there is a button in the current page, after the button is clicked for the first time, a popup window will be opened, and the function of the button changes from "open" to "close", the click event corresponding to the button is bound with a first event monitoring function, and then when the button is clicked again, the popup window will be closed, the click event corresponding to the button is bound with a second event monitoring function. With the increase in the number of clicks on the button, the click event corresponding to the button will be bound with more event monitoring functions. Therefore, the event monitoring functions bound by the event can be deleted to prevent memory leakage.
[0067] In step 306, the event to be executed is bound with the preset event monitoring function.
[0068] In this disclosure, when the event is a valid event, the user can directly feel the response speed of the browser to the event through the change of the page. When the event is an invalid event, the user cannot directly feel the response speed of the browser to the event. Therefore, the valid event can be monitored.
[0069] In this disclosure, in the case that the event to be executed is a valid event, the event binding API can be called to complete the binding of the event monitoring function and the event to be executed.
[0070] Step 307, obtaining a second time point at which the event monitoring function is executed.
[0071] Step 308, determining the response duration of the browser under the event to be executed according to the time interval between the second time point and the first time point.
[0072] In the embodiment, the specific implementation process of steps 307-308 can refer to the detailed description of the above embodiment, which will not be repeated here.
[0073] In the present disclosure, after receiving the event trigger request, the target callback function is determined according to the type of the event to be executed, and the event to be executed is bound with the callback function. Then, the functions currently bound by the page element associated with the event to be executed are determined. If the event monitoring function is included in the bound functions, the bound event monitoring function is removed, and the event to be executed is bound with the preset event monitoring function. Then, after obtaining the second time point at which the event monitoring function is executed, the response duration of the browser under the event to be executed can be determined according to the time interval between the second time point and the first time point. Thus, by deleting the event monitoring function bound by the page element associated with the event to be executed, the memory leak caused by registering too many event monitoring functions can be prevented, thereby improving the stability of program running and providing conditions for comprehensive and accurate monitoring of the performance of the browser.
[0074] In actual application, if the response duration of each event recorded by the browser client is obtained, a large amount of response duration data may be cached. However, the browser cache space is limited, and when a large amount of data is stored, the performance of the browser may be reduced. Therefore, each client can periodically upload the monitoring data to the server of the browser, which not only reduces the data cache pressure on the client side, but also enables the server to statistically and analyze the performance of the browser according to the data returned by each client. Figure 4 The above process will be described in detail, Figure 4 Another method for obtaining browser running data provided by the embodiment of the present disclosure.
[0075] Step 401, receiving an event trigger request, wherein the trigger request includes an event to be executed and a first time point corresponding to the trigger request.
[0076] Step 402, in the case of binding the event to be executed with a callback function, binding the event to be executed with a preset event monitoring function.
[0077] Step 403, obtaining a second time point at which the event monitoring function is executed.
[0078] At step 404, the response time length of the browser under the to-be-executed event is determined according to the time interval between the second time and the first time.
[0079] In the embodiment, the specific implementation process of steps 401-404 can refer to the detailed description of any embodiment of the present disclosure, which will not be repeated here.
[0080] At step 405, the response time length of the browser under the to-be-executed event is recorded.
[0081] In the embodiment, after the response time length of the browser under the to-be-executed event is determined, the response time length can be written into the log file in any format.
[0082] The format of the record can be that an event name and a corresponding response time length are recorded in each line, and the event name and the corresponding time length can also be taken as a unit, and the units are separated by semicolons. The log file can be automatically created when the browser starts running, or can be created when the first response time length data is monitored.
[0083] At step 406, in a case where the number of recorded response time lengths is greater than a threshold value, the response time length distribution characteristics of the browser under each type of event are determined according to the event type corresponding to each response time length.
[0084] In the present disclosure, the browser client records a large amount of response time length data, but when analyzing the performance of the browser, only the response time length distribution characteristics of each type of event need to be focused on, and each response time length data does not need to be focused on. Therefore, the browser client can first determine the response time length distribution characteristics corresponding to each type of event according to the event type corresponding to each recorded response time length, and then only upload the distribution characteristics of the response time length, so as to reduce the amount of uploaded data and shorten the time of uploading data.
[0085] In the embodiment, the browser client can monitor the size of the log file recording the response time length in real time, or can automatically update the number of recorded response time lengths when data is written into the log file each time. If the log file is greater than the set threshold value, the data in the log file is classified according to the event type, and the response time length data of each type of event is counted to determine the response time length distribution characteristics of each type of event.
[0086] The distribution characteristics of the response time length can include the mean value of the response time length, the quantile value of the response time length, the extreme value of the response time length, the sample value of the response time length, and the like. Thus, according to the various response time length distribution characteristics, the performance of the browser can be more comprehensively and accurately analyzed.
[0087] At step 407, the response time length distribution characteristics of the browser under each type of event are sent to the server of the browser.
[0088] In the present disclosure, after each browser client sends the response time distribution features of each type of recorded event to the server side of the browser, the browser client can clear the log file storing the response time.
[0089] Optionally, the attribute information of the terminal device where the browser client is currently located can also be sent to the server side of the browser, so that the server side of the browser can determine the response to the same event on different terminal devices according to the attribute information of the terminal device where the browser client is located.
[0090] In the present disclosure, after receiving the event trigger request, the to-be-executed event is bound to the preset event monitoring function in the case of binding the to-be-executed event to the callback function, and then the time interval between the second time when the event monitoring function is executed and the first time can be determined to determine the response time of the browser under the to-be-executed event. Then, according to the event type corresponding to each response time, the response time distribution features of the browser under each type of event are determined, and the response time distribution features are sent to the server side of the browser. Thus, by sending the response time distribution features of the browser under each type of event to the server side of the browser, the server side can perform unified statistics and analysis on the performance of the browser according to the data returned by each client, thereby improving the ease of use of performance analysis of the browser.
[0091] To implement the above-mentioned embodiments, the present disclosure further provides a browser running data acquisition device. Figure 5 A structure diagram of a browser running data acquisition device provided by the present disclosure is shown.
[0092] As shown in Figure 5 The processing device 500 of the service request includes a receiving module 510, a binding module 520, an acquisition module 530, and a first determination module 540.
[0093] The receiving module 510 is configured to receive an event trigger request, wherein the trigger request includes a to-be-executed event and a first time corresponding to the trigger request.
[0094] The binding module 520 is configured to bind the to-be-executed event to a preset event monitoring function in the case of binding the to-be-executed event to a callback function.
[0095] The acquisition module 530 is configured to acquire a second time when the event monitoring function is executed.
[0096] The first determining module 540 is configured to determine a response duration of the browser under the to-be-executed event according to a time interval between the second time and the first time.
[0097] In a possible implementation of the embodiment of the present disclosure, the binding module is specifically configured to:
[0098] In a case where the to-be-executed event is determined to be a valid event, a target callback function to be bound is determined according to a type of the to-be-executed event.
[0099] The to-be-executed event is bound to the target callback function.
[0100] In a possible implementation of the embodiment of the present disclosure, the apparatus further includes:
[0101] The recording module is configured to record the response duration of the browser under the to-be-executed event.
[0102] The second determining module is configured to, in a case where the number of recorded response durations is greater than a threshold, determine a response duration distribution feature of the browser under each type of event according to an event type corresponding to each response duration.
[0103] The sending module is configured to send the response duration distribution feature of the browser under each type of event to a server of the browser.
[0104] In a possible implementation of the embodiment of the present disclosure, the sending module is further configured to:
[0105] Send attribute information of a terminal device currently accessed by a client of the browser to the server of the browser.
[0106] In a possible implementation of the embodiment of the present disclosure, the response duration distribution feature includes at least one of a response duration mean value, a response duration quantile value, a response duration extreme value, and a response duration sample value.
[0107] In a possible implementation of the embodiment of the present disclosure, the binding module is specifically configured to:
[0108] Determine functions currently bound by a page element associated with the to-be-executed event.
[0109] In a case where the functions currently bound include an event monitoring function, remove the event monitoring function currently bound.
[0110] It should be noted that the explanation and description of the foregoing embodiment of the browser running data acquisition method are also applicable to the apparatus of the embodiment, and thus will not be described herein again.
[0111] In the present disclosure, after receiving the event triggering request, in the case that it is determined that the event to be executed is bound to the callback function, the event to be executed is bound to the preset event monitoring function, and then after obtaining the second time point of executing the event monitoring function, the response time length of the browser under the event to be executed can be determined according to the time interval between the second time point and the first time point. Thus, by binding the event to be executed to the event monitoring function, the accuracy of monitoring the execution time length of each page event is improved, and the accuracy of monitoring the browser performance is improved. By monitoring the event to be executed, the scenario of monitoring the browser is increased, and the comprehensiveness of monitoring the browser performance is increased.
[0112] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0113] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the present disclosure described and / or claimed in this document.
[0114] As Figure 6 shown, the device 600 includes a computing unit 601 that can perform various suitable actions and processes in accordance with computer programs stored in a ROM (Read-Only Memory) 602 or loaded into a RAM (Random Access Memory) 603 from the storage unit 608. Various programs and data required for operation of the device 600 can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604.
[0115] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through computer networks, such as the Internet, and / or various telecommunication networks.
[0116] The computing unit 601 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs various methods and processes described above, such as the method of acquiring browser runtime data. For example, in some embodiments, the method of acquiring browser runtime data can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded to the RAM 603 and executed by the computing unit 601, one or more steps of the method of acquiring browser runtime data described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the method of acquiring browser runtime data by other any appropriate means, such as by means of firmware.
[0117] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application-Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a System on a Chip (SOC), a Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0118] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general or special purpose computer, such that the program code, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
[0119] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include a linearly-programmed electronic storage, a portable computer diskette, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory), or flash memory, an optical fiber, a CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0120] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0121] The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a LAN (Local Area Network), a WAN (Wide Area Network), the Internet, and a blockchain network.
[0122] The computer system can include clients and servers. This relationship can be between a client and a server that are typically remote from each other and typically interact through a communication network. The relationship between client and server exists by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service (Virtual Private Server). The server can also be a server of a distributed system, or a server combined with a blockchain.
[0123] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, when an instruction processor in the computer program product executes, executes the method for acquiring browser running data proposed in the above embodiments of the present disclosure.
[0124] It should be understood that the steps shown above can be reordered, added, or deleted using various forms of flow. For example, each step described in the present disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, which is not limited herein.
[0125] The above detailed description does not constitute a limitation on the scope of protection of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements within the spirit and principles of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A method for obtaining browser runtime data, comprising: Receive an event trigger request, wherein the trigger request includes an event to be executed and a first moment corresponding to the trigger request, and the event to be executed is an event triggered when the user interacts with the browser page; When the event to be executed is bound to a callback function, the event to be executed is also bound to a preset event monitoring function; Obtain the second moment of execution of the event monitoring function; The response time of the browser under the event to be executed is determined based on the time interval between the second time and the first time. The step of binding the event to be executed with the callback function includes: If the event to be executed is determined to be a valid event, the target callback function to be bound is determined according to the type of the event to be executed; Bind the event to be executed to the target callback function.
2. The method as described in claim 1, wherein, After determining the browser's response time for the event to be executed, the method further includes: Record the browser's response time for the event to be executed; If the number of recorded response durations exceeds a threshold, determine the response duration distribution characteristics of the browser under each type of event based on the event type corresponding to each response duration; The browser's response time distribution characteristics under various types of events are sent to the browser's server.
3. The method as described in claim 2, wherein, Also includes: The browser's client currently accesses the attribute information of the terminal device it is using, and sends this information to the browser's server.
4. The method of claim 2, wherein, The response duration distribution characteristics include at least one of the following: mean response duration, quantile of response duration, extreme value of response duration, and sampled value of response duration.
5. The method as described in any one of claims 1-4, wherein, Before binding the event to be executed to the preset event monitoring function, the method further includes: Determine the functions currently bound to the page elements associated with the event to be executed; If the bound functions include event monitoring functions, remove the bound event monitoring functions.
6. A device for acquiring browser runtime data, comprising: A receiving module is used to receive an event triggering request, wherein the triggering request includes an event to be executed and a first moment corresponding to the triggering request, and the event to be executed is an event triggered when the user manipulates the browser page; The binding module is used to bind the event to be executed to a preset event monitoring function when the event to be executed is bound to a callback function; The acquisition module is used to acquire the second moment of execution of the event monitoring function; The first determining module is used to determine the response time of the browser under the event to be executed based on the time interval between the second time and the first time. Specifically, the binding module is used for: If the event to be executed is determined to be a valid event, the target callback function to be bound is determined according to the type of the event to be executed; Bind the event to be executed to the target callback function.
7. The apparatus of claim 6, further comprising: A recording module is used to record the response time of the browser under the event to be executed; The second determining module is used to determine the response duration distribution characteristics of the browser under each type of event, based on the event type corresponding to each response duration, when the number of recorded response durations is greater than a threshold. The sending module is used to send the response time distribution characteristics of the browser under various types of events to the browser's server.
8. The apparatus of claim 7, wherein the transmitting module is further configured to: The browser's client currently accesses the attribute information of the terminal device it is using, and sends this information to the browser's server.
9. The apparatus of claim 7, wherein, The response duration distribution characteristics include at least one of the following: mean response duration, quantile of response duration, extreme value of response duration, and sampled value of response duration.
10. The apparatus according to any one of claims 6-9, wherein the binding module is specifically used for: Determine the functions currently bound to the page elements associated with the event to be executed; If the bound functions include event monitoring functions, remove the bound event monitoring functions.
11. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-5.
13. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-5.
Citation Information
Patent Citations
Method for monitoring webpage user operation experience, equipment and storage medium
CN112346944A