CN116467136A - Smoothness monitoring method, device and equipment for application program and storage medium - Google Patents

Smoothness monitoring method, device and equipment for application program and storage medium Download PDF

Info

Publication number
CN116467136A
CN116467136A CN202310240148.1A CN202310240148A CN116467136A CN 116467136 A CN116467136 A CN 116467136A CN 202310240148 A CN202310240148 A CN 202310240148A CN 116467136 A CN116467136 A CN 116467136A
Authority
CN
China
Prior art keywords
application program
task
execution
main thread
fluency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310240148.1A
Other languages
Chinese (zh)
Inventor
侯一鸣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu com Times Technology Beijing Co Ltd
Original Assignee
Baidu com Times Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Baidu com Times Technology Beijing Co Ltd filed Critical Baidu com Times Technology Beijing Co Ltd
Priority to CN202310240148.1A priority Critical patent/CN116467136A/en
Publication of CN116467136A publication Critical patent/CN116467136A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3072Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a smoothness monitoring method, device, equipment and storage medium for an application program, relates to computer technology, and particularly relates to the field of application program products. The specific implementation scheme is as follows: in the running process of the application program, the task in the main thread in the application program is monitored by starting a fluency monitoring function, the total execution time of the task in the main thread, namely the first execution time, and the total execution time of the task exceeding a preset execution time threshold, namely the second execution time, are obtained, then the fluency index of the whole application program is calculated according to the first execution time and the second execution time, a fluency measuring scheme and index are provided, the fluency of the whole application program is measured by using the fluency index, data support can be provided in the optimizing process of the application program, and the actual use experience of a user can be known based on the index.

Description

Smoothness monitoring method, device and equipment for application program and storage medium
Technical Field
The present disclosure relates to the field of application program products in computer technology, and in particular, to a method, an apparatus, a device, and a storage medium for monitoring smoothness of an application program.
Background
With the development of computer technology, users install application programs on smart terminals such as mobile phones and tablet computers to obtain different services, and the types of the application programs and the types of services in each application program are increasing. With the business iteration of the application program, more tasks are run in the application program, which tends to cause poorer running fluency, so that the fluency of the application program needs to be optimized, but the types of intelligent terminals such as mobile phones of users are more, the performance states of each intelligent terminal have larger gap, and no suitable scheme for evaluating the overall fluency condition of the application program exists at present.
In summary, in order to optimize the overall fluency of an application program, a measure of fluency is required, and no such technical solution is available at present.
Disclosure of Invention
The disclosure provides a smoothness monitoring method, device and equipment for an application program and a storage medium.
According to a first aspect of the present disclosure, there is provided a smoothness monitoring method of an application program, including:
after an application program starts a fluency monitoring function, each task in a main thread in the application program is monitored, and a first execution duration of the main thread of the application program and a second execution duration corresponding to at least one long task are collected, wherein the second execution duration is the sum of the execution durations of the at least one long task, and the at least one long task is a task with the execution duration exceeding a preset execution duration threshold;
And calculating and acquiring the fluency index of the application program according to the first execution duration and the second execution duration.
According to a second aspect of the present disclosure, there is provided a smoothness monitoring device for an application program, including:
the system comprises a monitoring unit, a control unit and a control unit, wherein the monitoring unit is used for monitoring each task in a main thread in an application program after the application program starts a fluency monitoring function, and collecting a first execution time length of the main thread of the application program and a second execution time length corresponding to at least one long task, wherein the second execution time length is the sum of the execution time lengths of the at least one long task, and the at least one long task is a task with the execution time length exceeding a preset execution time length threshold;
the first processing unit is used for calculating and acquiring the fluency index of the application program according to the first execution duration and the second execution duration.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of the first aspect.
According to a fifth aspect of the present disclosure, there is provided a computer program product comprising: a computer program stored in a readable storage medium, from which it can be read by at least one processor of an electronic device, the at least one processor executing the computer program causing the electronic device to perform the method of the first aspect.
According to the technical scheme, in the running process of the application program, the task in the main thread of the application program is monitored by starting the fluency monitoring function, the total execution time of the task in the main thread, namely the first execution time, and the total execution time of the task exceeding the preset execution time threshold, namely the second execution time, are obtained, then the fluency index of the whole application program is calculated according to the first execution time and the second execution time, a fluency measuring scheme and index are provided, the fluency of the whole application program is measured by using the fluency index, data support can be provided in the optimizing process of the application program, and the actual use experience of the user can be known based on the index.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a flowchart of a method for monitoring smoothness of an application according to a first embodiment of the present disclosure;
fig. 2 is a flowchart of a method for monitoring smoothness of an application according to a second embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a main thread loop within an application provided by an embodiment of the present disclosure;
fig. 4 is a schematic diagram of a screen refreshing principle according to an embodiment of the present disclosure;
fig. 5 is a flowchart of a method for monitoring smoothness of an application according to a third embodiment of the present disclosure;
FIG. 6 is a flowchart of task execution duration acquisition provided in an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an application program smoothness monitoring device according to an embodiment of the present disclosure;
fig. 8 shows a schematic block diagram of an example electronic device used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one 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 well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the current business iteration of Application (APP), tasks to be operated are more and more, and APP operation fluency is inevitably caused to be worse and worse, so that APP fluency problems in the development or operation and maintenance process are required to be optimized, but mobile phone models of users are different, performances are also different, so that the effect of optimizing how to measure APP fluency becomes a problem, in the prior art, no fluency measurement index is available for measuring APP current fluency problems, and optimized fluency conditions are not measured.
Aiming at the existing problems, the inventor researches the working principle of the bottom layer of the APP in the process of researching the operation of the APP, discovers that different tasks are operated by continuously cycling in the main thread in the operation process of the application program, namely, the task needs to be awakened in the process of executing the task in the cycle of the main thread, and the task enters a dormant state after the task is executed, and other times are dormant states, so that the method can calculate an index for measuring the smoothness of the APP by counting the execution time of the task, comparing the execution time with a threshold value of the execution time of the task tested by experiments, determining the execution time of the task which consumes more than the threshold value, namely, the problem occurs in the execution process of the task and combining the total execution time of the whole main thread. Based on the method, the device and the system for counting the working time of the main thread and the long time-consuming task generated during the working period of the main thread are provided, so that a core index for measuring the working smoothness of the main thread is generated through data calculation.
The scheme can be applied to terminal equipment provided with an iOS system, an android system, a windows system and the like, and a smoothness monitoring function needs to be added in an APP during specific implementation, the smoothness monitoring function is started in the APP operation process, then related interfaces provided by the system are called to count related data, and the interfaces called in different systems are different.
The following detailed description is given of the technical solutions of the present disclosure and how the technical solutions of the present disclosure solve the above technical problems with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
The following describes a specific implementation scheme of the smoothness monitoring method of the application program provided by the present disclosure.
Fig. 1 is a flowchart of a method for monitoring smoothness of an application according to a first embodiment of the present disclosure. As shown in fig. 1, the method for monitoring the smoothness of the application program specifically includes the following steps:
s101: after the application program starts the fluency monitoring function, tasks in the main thread in the application program are monitored, and the first execution duration of the main thread of the application program and the second execution duration corresponding to at least one long task are collected.
In this solution, the second execution duration is a sum of execution durations of the at least one long task, where the at least one long task is a task whose execution duration exceeds a preset execution duration threshold. Long tasks herein refer to long time-consuming tasks, which in a particular implementation include tasks that are performed in one cycle of the main thread of the application. It should be understood that the task or the long task in this solution refers to all tasks executed in one cycle of the main thread, which is a generic term, and in an actual implementation, one task or more than one task may be executed in one cycle of the main thread, and how many subtasks are split into in a specific cycle period is determined by the system.
In this step, in the process of running an application program, when the smoothness monitoring function is turned on, statistics and calculation are required for data related to smoothness of the program. In response to a user operation, an application program executes related tasks in a main thread, in the process, data collection needs to be performed on long tasks in the main thread respectively, and the execution duration of each task needs to be recorded, so that the total execution duration of the tasks of the main thread of the application program, namely, the first execution duration, can be obtained finally. In the process, a task with long time consumption is screened out to count the second execution time based on a preset task execution time threshold corresponding to each cycle in the process of executing the task by the main thread.
In one possible implementation manner, the smoothness monitoring function in the application program may be started manually by a user, or may be started automatically by program triggering, that is, after the application program is started, the smoothness monitoring function is started. For example, the code for automatically starting the function may be written in the application program during the development of the application program, and the smoothness monitoring function may be automatically started after the application program is started and operated, or the smoothness monitoring function may be started after a preset period of time after the application program is started and operated, which is not limited in this scheme.
S102: and calculating and acquiring the fluency index of the application program according to the first execution duration and the second execution duration.
In this step, after the total execution duration of the long task (i.e., the second execution duration) and the total task execution duration of the main thread (i.e., the first execution duration) are collected during the running process of the application program, the smoothness index of the whole application program can be calculated according to the first execution duration and the second execution duration, and the running smoothness of the whole application program can be measured by using the smoothness index.
In a specific implementation manner, a ratio of two durations may be used as the fluency index, for example, a ratio of the second execution duration to the first execution duration may be determined as the fluency index of the application program, where the magnitude of the fluency index is inversely proportional to the fluency of the application program. That is, the larger the smoothness index is, the higher the execution duration of the long task in the main thread of the application program is, and the worse the smoothness is. The smaller the fluency index is, the lower the execution time length ratio of the long task in the main thread of the application program is, and the better the task fluency is.
According to the smoothness monitoring method for the application program, in the running process of the application program, the smoothness monitoring function is started to monitor tasks in a main thread of the application program, the total execution time of the tasks in the main thread, namely the first execution time, and the total execution time of the tasks exceeding the preset execution time threshold, namely the second execution time, are obtained, then the smoothness index of the whole application program is calculated according to the first execution time and the second execution time, a smoothness measuring scheme and index are provided, the smoothness of the whole application program is measured by using the smoothness index, data support can be provided in the optimizing process of the application program, and the actual use experience of a user can be known based on the index.
Fig. 2 is a flowchart of a method for monitoring smoothness of an application according to a second embodiment of the present disclosure. As shown in fig. 2, on the basis of the above-described embodiment, step S101 in the first embodiment includes the steps of:
s1011: and monitoring state change in a cycle period of a main thread in the application program, recording the time length between awakening and entering the sleep state in the cycle, and obtaining the execution time length of the task in the cycle.
In this step, after the application program is started, the related functions of the application program are realized by executing the distributed tasks of the systems on the main thread, the work of the main thread depends on the scheduling execution of the loop interface of the terminal device, the loop interface is automatically started when the main thread starts to work, after the main thread enters the loop, the related resources are processed in the loop to realize the corresponding functions, then the main thread enters the sleep mode, and the main thread is awakened again when the task needs to be executed next time. Specific flow is shown in fig. 3, and fig. 3 is a schematic diagram of main thread loop in an application provided in an embodiment of the disclosure. After the cycle is awakened, starting to process the timer task, processing the task resource, and entering a dormant state after the processing is completed.
S1012: accumulating the execution time lengths of all tasks in the main thread to obtain a first execution time length.
In this step, after the main thread ends, that is, after the application program stops running (for example, exits the program or exits the interface), the execution time periods of all tasks in the main thread of the application program are monitored, and then the total execution time period of the tasks in the main thread, that is, the first execution time period, can be obtained by accumulating the execution time periods of the tasks.
S1013: aiming at the task in each cycle in the main thread, when the execution time of the task is longer than a preset execution time threshold, determining that the task is a long task.
In the step, in the execution process of the main thread, a timer is adopted in each cycle to record the time between the cycle wakeup and the sleep going to be carried out, so that the execution duration of the task is obtained. After the execution time of the task in each cycle is obtained, the execution time is required to be compared with a preset execution time threshold of the task corresponding to the cycle, whether the execution time exceeds the execution time threshold is determined, and if the execution time exceeds the execution time threshold, the task can be confirmed to be a long time-consuming task, namely the long task.
In this scheme, it should be understood that the execution duration threshold of the task corresponding to each cycle is preset, and the execution duration threshold corresponding to each cycle may be configured in related parameters in the process of program development, and may be directly adopted when application is needed, or may be configured through the cloud end (or cloud end server) of the application program. That is, the application program may receive a program configuration message sent by the cloud, where the configuration message includes an execution duration threshold corresponding to a task in each cycle in the application program. The program configuration message may also be used to configure information related to the model.
In a possible implementation manner, when any task is monitored to belong to a long time-consuming task in the running process of the main thread of the application program, relevant information of the long task can be recorded besides the execution time of the long task, so that optimization can be performed based on the relevant information in the optimizing process of the application program. Specifically, related information of each long task may be recorded according to a preset rule, where the related information may include an identifier of the long task, a time-consuming stack corresponding to the long task, and a code execution path of a preset period before an abnormality occurs.
S1014: accumulating the execution time lengths of all the long tasks in the main thread to obtain a second execution time length.
In this step, after the main thread is finished and the execution time periods of all the long tasks in the main thread of the application program are monitored, the total execution time period of the long tasks in the main thread, that is, the second execution time period, can be obtained by accumulating the execution time periods of the long tasks.
According to the smoothness monitoring method for the application program, in the process of acquiring related data such as task duration, a system interface is added to equipment where the application program is located to acquire a state of a circulation callback, the execution duration of the task is acquired by counting time between each time of waking up to enter a dormant state, and then the execution duration of the long task is determined based on a preset execution duration threshold value, so that a first execution duration and a second execution duration capable of calculating smoothness indexes are finally obtained, the performance of the equipment and the application program and related services are not affected in the whole process, the architecture of the application program is not changed, a monitoring scheme of the related data is provided on the premise of guaranteeing the service performance, and therefore smoothness measurement of an application program product is achieved, and data support is provided for optimization of the application program.
Based on the foregoing embodiments, the following describes the present scheme in detail, taking the smoothness monitoring of the application program in the terminal device of the iOS system as an example.
Fig. 4 is a schematic diagram of a screen refreshing principle provided by an embodiment of the present disclosure, as shown in fig. 4, where a long time-consuming task from the perspective of a graphical user interface may cause a screen refreshing phenomenon that is not timely, that is, a visually obvious clamping phenomenon. The main principle is as follows: it can be seen from fig. 4 that the application program performs a long time-consuming task in one cycle (RunLoop), resulting in a later time for the task result to be submitted to the rendering service (Render Server), i.e. exceeding the vsync signal submission time, which results in the Render Server not having data to Render in the next cycle of the task cycle, and the result to be conducted to the screen is that no new content is on the screen, until the user actually sees that the device interface is stuck. This is one scenario where long tasks result in poor user experience.
Based on this, in order to optimize the application program, a specific data support is required for the fluency, and the core of the scheme is to propose and implement a fluency index measurement standard, and by establishing the standard, the fluency condition of the on-line device and the optimizing effect of the business on the fluency are measured. The technical implementation level is to calculate final fluency index data by adopting two items of data, namely main thread execution duration and main thread long time-consuming task execution duration, through an algorithm according to the statistics of the main thread working duration and the statistics of the main thread long time-consuming task. Fig. 5 is a flow chart of a method for monitoring smoothness of an application program according to a third embodiment of the present disclosure, and as shown in fig. 5, the method for monitoring smoothness is specifically implemented as follows:
S201: and starting a fluency monitoring function.
In this step, after the terminal device (for example, a smart phone) starts the application program provided with the smoothness monitoring function based on the operation of the user, the application program may be automatically triggered to start the smoothness monitoring function, so that the smoothness index can be obtained in the process of using the application program by the user. After the fluency monitoring function is started, the tasks of the main thread and the long tasks are required to be counted and collected in parallel respectively.
S202: and starting the collection of long tasks in the main thread.
S203: the sub-thread monitors the loop state switching.
S204: and calculating the execution time length of the long task.
In the steps, the application program acquires the callback of each state in the process of executing the NSRunLoop by registering the callback of the state change in the process of executing the task of the main thread of the application program, and records the time from the time of waking up the NSRunLoop to the time of going into the dormant state, thereby acquiring the execution time of the task in the NSRunLoop. The calling in this way can obtain the execution time of each task in the main thread.
After the execution duration of any task is obtained, the execution duration threshold corresponding to the NSRunLoop is required to be compared, whether the task in the NSRunLoop is a long task is determined, if the execution duration of the compared task is greater than the execution duration threshold, the task executed in the NSRunLoop is determined to be a long task, and in the whole main thread task execution process, the execution durations of all the long tasks determined in the mode are accumulated, so that the total execution duration of the long task is obtained.
Optionally, in a specific embodiment, the execution duration threshold corresponding to NSRunLoop in the application program may be preconfigured in the program, or may be information configured by the cloud end to issue the program, for example: s210: and the cloud end transmits program configuration information to configure the execution time threshold of the task and the related information of the machine type.
S205: starting the execution time statistics of the main thread;
s206: the main thread directly counts the sleep and wake states.
S207: and calculating the execution time length of the main thread.
In the steps, in the execution process of the main thread of the application program, the execution time of the tasks in each cycle is obtained by monitoring the state of the cycle, and finally the execution time of all the tasks is accumulated to obtain the execution time of the whole main thread. In an application program of the iOS system, a callback of each state in the NSRunLoop execution process is acquired by registering a callback of NSRunLoop state change, the time from the time when the NSRunLoop is awakened to the time when the NSRunLoop is to enter a dormant state is recorded, the execution time of a task in the NSRunLoop is acquired, and finally the execution time of the task in each NSRunLoop is accumulated, so that the total execution time is acquired.
And finally, calculating a flow smoothness index based on the total execution time length of the long task and the total execution time length of the main thread, wherein the method specifically comprises the following steps of:
s208: and (5) data statistics and summarization, and calculating a fluency index.
S209: and stopping the fluency monitoring.
In the specific implementation of the scheme, the whole flow is divided into the following main flows:
first, count the long time-consuming task of the main thread
The work of the main thread of the iOS end depends on the scheduling execution of NSRunLoop, and when the main thread starts to work, the NSRunLoop can be started automatically. NSRunLoop is used as an internal scheduling interface of the system, and the actual work is black-box, but several key nodes of NSRunLoop are exposed to the outside of a developer, including: entering NSRunLoop, processing Timers, processing Sources, entering dormancy, waking up, exiting NSRunLoop, and the like. The several state callbacks can be obtained by registering a NSRunLoop state snoop. The scheme utilizes the state callbacks to achieve the purpose of acquiring a long time-consuming task. Fig. 6 is a flowchart of task execution duration acquisition according to an embodiment of the present disclosure, and as can be seen in fig. 6, a state loop of a main thread NSRunLoop.
The refresh frequency of the current commonly used mobile phone model is 60HZ (except for the partially high-brushing model), that is, the screen refresh vsync signal can send 60 refresh commands every second, and meanwhile, the source code of the NSRunLoop is combined to see that each NSRunLoop period is about to end and one UI submission is performed, that is, the task execution period of the NSRunLoop is less than 1000 ms/60=16.67 ms, so that the graphic user interface refresh submission cannot be affected. The counted long task in the scheme is to monitor the time length of each task execution period of NSRunLoop to see if the time length exceeds a certain long task threshold, if so, the long task is a long time-consuming task, and recording is needed according to a certain rule.
Second,: counting working time of main thread
The statistics of the working time length of the main thread is actually returned to the interface depending on the externally exposed state of the NSRunLoop, wherein two states, namely, kCFRunLoopAfterWatting and KCFRuneLoopBeforeWaitting, respectively represent that the current NSRunLoop is awakened and the current NSRunLoop is about to enter dormancy, and the working time length between the two states is recorded in the program to be regarded as the working time length of the main thread NSRunLoop. As shown in fig. 6, the NSRunLoop working duration of each NSRunLoop period is recorded, and the accumulated NSRunLoop working duration is the current main thread NSRunLoop working duration, and can also be regarded as the current main thread working duration. If NSRunloop is adopted as the cycle start statistical point, and NSRunloop is awakened as the cycle end point, the main thread sleep time can be counted, and the statistical requirements are specifically considered.
Third, calculate the main thread fluency index
Finally, the total execution duration of the long task and the total execution duration of the main thread are collected through the long task of the main thread, the fluency index of the current main thread is calculated through a certain calculation rule, the value is used as a measurement standard of the online fluency condition, in a specific implementation mode, the ratio of the total execution duration of the long task to the total execution duration of the main thread can be used as the fluency index, the fluency index calculated in the mode is inversely proportional to the fluency, namely, the larger the fluency index is, the longer the execution duration of the long task is, the worse the fluency is, and otherwise, the higher the fluency is if the fluency index is smaller.
Experiments prove that the scheme has no negative influence on the performance of the terminal equipment.
According to the smoothness monitoring method for the application program, a smoothness index measurement standard is provided, smoothness conditions of on-line equipment and optimization effects of a measurement service on smoothness are measured through establishment of the standard, the overall smoothness of the application program is measured through statistics of working duration of the main program and statistics of long time-consuming tasks of the main program of the application program, calculation of two items of data including execution duration of the main program and execution duration of the long time-consuming tasks of the main program is achieved through an algorithm, and the smoothness index is finally calculated based on the two items of data.
Fig. 7 is a schematic structural diagram of an application program smoothness monitoring device according to an embodiment of the present disclosure. As shown in fig. 7, the resource recommendation device 700 provided in this embodiment includes:
the monitoring unit 701 is configured to monitor each task in a main thread of an application program after the application program starts a fluency monitoring function, and collect a first execution duration of the main thread of the application program and a second execution duration corresponding to at least one long task, where the second execution duration is a sum of execution durations of the at least one long task, and the at least one long task is a task whose execution duration exceeds a preset execution duration threshold;
the first processing unit 702 is configured to calculate and obtain a fluency index of the application according to the first execution duration and the second execution duration.
The smoothness monitoring device for an application program provided in this embodiment may be used to execute the smoothness monitoring method for an application program in any of the above method embodiments, and its implementation principle and technical effects are similar, and will not be described in detail herein.
In one possible implementation manner, the monitoring unit 701 includes:
the first monitoring module is used for monitoring state change in a cycle period of the main thread in the application program, recording the time length between awakening to enter a sleep state in the cycle, and obtaining the execution time length of a task in the cycle;
The first calculation module is used for accumulating the execution time length of all tasks in the main thread to obtain the first execution time length;
the first processing module is used for determining that the task is a long task when the execution duration of the task is greater than a preset execution duration threshold value aiming at the task in each cycle in the main thread;
and the second calculation module is used for accumulating the execution time lengths of all the long tasks in the main thread to obtain the second execution time length.
In one possible implementation, the apparatus 700 further includes:
the receiving unit 703 is configured to receive a program configuration message sent by the cloud, where the configuration message includes an execution duration threshold corresponding to a task in each cycle in the application.
In one possible implementation, the apparatus 700 further includes:
and a storage unit 704, configured to record, according to a preset rule, relevant information of each long task, where the relevant information includes an identifier of the task, a time-consuming stack corresponding to the long task, and a code execution path of a preset period before an abnormality occurs.
In one possible implementation, the first processing unit 702 includes;
And the second processing module is used for determining the ratio of the second execution duration to the first execution duration as a fluency index of the application program, wherein the magnitude of the fluency index is inversely proportional to the fluency of the application program.
In another possible embodiment, the apparatus 700 further comprises:
the second processing unit 705 is configured to trigger to start the smoothness monitoring function after the application program is started.
On the basis of any of the foregoing embodiments, in one possible implementation manner, the application program is an application program in the iOS system, and the first monitoring module is specifically configured to:
and in the process of executing tasks by the main thread of the application program, registering a callback of NSRunLoop state change, thereby acquiring the callback of each state in the process of executing NSRunLoop, recording the duration from the time when NSRunLoop is awakened to the time when NSRunLoop is about to enter a dormant state, and obtaining the execution duration of the tasks in the NSRunLoop, wherein the cycle comprises the NSRunLoop.
The smoothness monitoring device for an application program provided in this embodiment may be used to execute the smoothness monitoring method for an application program in any of the above method embodiments, and its implementation principle and technical effects are similar, and will not be described herein.
In the technical scheme of the disclosure, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the user accord with the regulations of related laws and regulations, and the public order colloquial is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a non-transitory computer-readable storage medium storing computer instructions, and a computer program product.
According to an embodiment of the present disclosure, the present disclosure also provides a computer program product comprising: a computer program stored in a readable storage medium, from which at least one processor of an electronic device can read, the at least one processor executing the computer program causing the electronic device to perform the solution provided by any one of the embodiments described above.
Fig. 8 shows a schematic block diagram of an example electronic device used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 8, the electronic device 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
Various components in device 800 are connected to I/O interface 805, including: an input unit 806 such as a keyboard, mouse, etc.; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, etc.; and a communication unit 809, such as a network card, modem, wireless communication transceiver, or the like. The communication unit 809 allows the device 800 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 801 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the respective methods and processes described above, such as a resource recommendation method. For example, in some embodiments, the resource recommendation method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 800 via ROM 802 and/or communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the resource recommendation method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured as a resource recommendation method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the 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.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may 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 a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
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 a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background 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 background, 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: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises 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 called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service ("Virtual Private Server" or simply "VPS") are overcome. The server may also be a server of a distributed system or a server that incorporates a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (17)

1. A method for smoothness monitoring of an application program, comprising:
after an application program starts a fluency monitoring function, monitoring tasks in a main thread in the application program, and collecting a first execution duration of the main thread of the application program and a second execution duration corresponding to at least one long task, wherein the second execution duration is the sum of the execution durations of the at least one long task, and the at least one long task is a task with the execution duration exceeding a preset execution duration threshold;
And calculating and acquiring the fluency index of the application program according to the first execution duration and the second execution duration.
2. The method of claim 1, wherein the monitoring each task in the main thread of the application program, collecting a first execution duration of the main thread of the application program, and a second execution duration corresponding to at least one long task, comprises:
monitoring state change in a cycle period of the main thread in the application program, recording duration between awakening and entering a sleep state in the cycle, and obtaining execution duration of tasks in the cycle;
accumulating the execution time length of all tasks in the main thread to obtain the first execution time length;
aiming at the task in each cycle in the main thread, when the execution duration of the task is greater than a preset execution duration threshold, determining that the task is a long task;
accumulating the execution time lengths of all the long tasks in the main thread to obtain the second execution time length.
3. The method of claim 2, wherein the method further comprises:
and receiving a program configuration message sent by the cloud, wherein the configuration message comprises an execution duration threshold value corresponding to a task in each cycle in the application program.
4. A method according to claim 2 or 3, characterized in that the method further comprises:
recording related information of each long task according to a preset rule, wherein the related information comprises an identifier of the long task, a time-consuming stack corresponding to the long task and a code execution path of a preset period before abnormality occurs.
5. A method according to any one of claims 1 to 3, wherein said calculating to obtain a smoothness index of the application program according to the first execution duration and the second execution duration includes;
and determining the ratio of the second execution duration to the first execution duration as a fluency index of the application program, wherein the magnitude of the fluency index is inversely proportional to the fluency of the application program.
6. A method according to any one of claims 1 to 3, wherein the method further comprises:
and triggering and starting the fluency monitoring function after the application program is started.
7. The method according to claim 2, wherein the application program is an application program in an iOS system, the monitoring a state change in a cycle period in the main thread in the application program, recording a duration between waking up in a sleep state in a cycle, and obtaining an execution duration of a task in the cycle, includes:
And in the process of executing tasks by the main thread of the application program, registering a callback of NSRunLoop state change, thereby acquiring the callback of each state in the process of executing NSRunLoop, recording the duration from the time when NSRunLoop is awakened to the time when NSRunLoop is about to enter a dormant state, and obtaining the execution duration of the tasks in the NSRunLoop, wherein the cycle comprises the NSRunLoop.
8. An application fluency monitoring device, comprising:
the system comprises a monitoring unit, a control unit and a control unit, wherein the monitoring unit is used for monitoring each task in a main thread in an application program after the application program starts a fluency monitoring function, and collecting a first execution time length of the main thread of the application program and a second execution time length corresponding to at least one long task, wherein the second execution time length is the sum of the execution time lengths of the at least one long task, and the at least one long task is a task with the execution time length exceeding a preset execution time length threshold;
the first processing unit is used for calculating and acquiring the fluency index of the application program according to the first execution duration and the second execution duration.
9. The apparatus of claim 8, wherein the monitoring module comprises:
The first monitoring module is used for monitoring state change in a cycle period of the main thread in the application program, recording the time length between awakening to enter a sleep state in the cycle, and obtaining the execution time length of a task in the cycle;
the first calculation module is used for accumulating the execution time length of all tasks in the main thread to obtain the first execution time length;
the first processing module is used for determining that the task is a long task when the execution duration of the task is greater than a preset execution duration threshold value aiming at the task in each cycle in the main thread;
and the second calculation module is used for accumulating the execution time lengths of all the long tasks in the main thread to obtain the second execution time length.
10. The apparatus of claim 9, wherein the apparatus further comprises:
the receiving unit is used for receiving a program configuration message sent by the cloud, wherein the configuration message comprises an execution duration threshold value corresponding to a task in each cycle in the application program.
11. The apparatus according to claim 9 or 10, characterized in that the apparatus further comprises:
the storage unit is used for recording the related information of each long task according to a preset rule, wherein the related information comprises the identification of the task, a time-consuming stack corresponding to the long task and a code execution path of a preset period before the occurrence of an abnormality.
12. The apparatus of any one of claims 8 to 10, wherein the first processing unit comprises;
and the second processing module is used for determining the ratio of the second execution duration to the first execution duration as a fluency index of the application program, wherein the magnitude of the fluency index is inversely proportional to the fluency of the application program.
13. The apparatus according to any one of claims 8 to 10, wherein the apparatus further comprises:
and the second processing unit is used for triggering and starting the fluency monitoring function after the application program is started.
14. The apparatus of claim 9, wherein the application is an application in an iOS system, and the first monitoring module is specifically configured to:
and in the process of executing tasks by the main thread of the application program, registering a callback of NSRunLoop state change, thereby acquiring the callback of each state in the process of executing NSRunLoop, recording the duration from the time when NSRunLoop is awakened to the time when NSRunLoop is about to enter a dormant state, and obtaining the execution duration of the tasks in the NSRunLoop, wherein the cycle comprises the NSRunLoop.
15. An electronic device, comprising:
At least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-7.
17. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any of claims 1-7.
CN202310240148.1A 2023-03-06 2023-03-06 Smoothness monitoring method, device and equipment for application program and storage medium Pending CN116467136A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310240148.1A CN116467136A (en) 2023-03-06 2023-03-06 Smoothness monitoring method, device and equipment for application program and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310240148.1A CN116467136A (en) 2023-03-06 2023-03-06 Smoothness monitoring method, device and equipment for application program and storage medium

Publications (1)

Publication Number Publication Date
CN116467136A true CN116467136A (en) 2023-07-21

Family

ID=87184781

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310240148.1A Pending CN116467136A (en) 2023-03-06 2023-03-06 Smoothness monitoring method, device and equipment for application program and storage medium

Country Status (1)

Country Link
CN (1) CN116467136A (en)

Similar Documents

Publication Publication Date Title
CN112540806A (en) Applet page rendering method and device, electronic equipment and storage medium
CN114978883B (en) Network wakeup management method and device, electronic equipment and storage medium
CN112767935B (en) Awakening index monitoring method and device and electronic equipment
CN109002381A (en) Process communication monitoring method, electronic device and computer readable storage medium
CN116594563A (en) Distributed storage capacity expansion method and device, electronic equipment and storage medium
CN116467136A (en) Smoothness monitoring method, device and equipment for application program and storage medium
CN113220554B (en) Method and apparatus for detecting performance of program code
CN114416476A (en) Operation monitoring method, device, equipment and storage medium for cloud mobile phone application
CN114363704A (en) Video playing method, device, equipment and storage medium
CN114051057A (en) Method and device for determining queuing time of cloud equipment, electronic equipment and medium
CN112631843A (en) Equipment testing method and device, electronic equipment, readable medium and product
CN106326599B (en) System state monitoring method and device for multiprocessor system simulation
CN113411390B (en) Scheduling method and device of content distribution network and electronic equipment
CN115563015B (en) Code heat statistics method, device, equipment and storage medium
CN116028228A (en) Bitmap memory occupation detection method, device, equipment and storage medium
CN114003367B (en) Risk monitoring method, device, equipment and storage medium
EP4099319A1 (en) Wake-up index monitoring method and apparatus, and electronic device
CN117014291A (en) Abnormal node determining method, device, equipment and medium based on workflow grouping
CN116450915A (en) Application degradation method, device, electronic equipment and storage medium
CN116662320A (en) Media resource data detection method and device, electronic equipment and storage medium
CN115729686A (en) Data processing method, device, equipment and storage medium
CN117472774A (en) Interface testing method, device, electronic equipment and storage medium
CN117634825A (en) Dynamic resource allocation method and device
CN115577228A (en) Electronic equipment use condition analysis method and device, server and storage medium
CN116186176A (en) Data processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination