CN114168222A - Method and device for acquiring starting time, terminal equipment and storage medium - Google Patents

Method and device for acquiring starting time, terminal equipment and storage medium Download PDF

Info

Publication number
CN114168222A
CN114168222A CN202111473492.2A CN202111473492A CN114168222A CN 114168222 A CN114168222 A CN 114168222A CN 202111473492 A CN202111473492 A CN 202111473492A CN 114168222 A CN114168222 A CN 114168222A
Authority
CN
China
Prior art keywords
time
application program
starting
execution
acquiring
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.)
Granted
Application number
CN202111473492.2A
Other languages
Chinese (zh)
Other versions
CN114168222B (en
Inventor
袁耀辉
程秋实
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Bo Hongyuan Data Polytron Technologies Inc
Original Assignee
Beijing Bo Hongyuan Data Polytron Technologies Inc
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 Beijing Bo Hongyuan Data Polytron Technologies Inc filed Critical Beijing Bo Hongyuan Data Polytron Technologies Inc
Priority to CN202111473492.2A priority Critical patent/CN114168222B/en
Publication of CN114168222A publication Critical patent/CN114168222A/en
Application granted granted Critical
Publication of CN114168222B publication Critical patent/CN114168222B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • 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/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3419Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment by assessing time
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Mathematical Physics (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a method and a device for acquiring starting time consumption, wherein the method comprises the following steps: responding to the detected running instruction sent by the operating system, and acquiring a starting mode of the application program; the starting mode comprises cold starting and hot starting; if the starting mode of the application program is cold starting, acquiring the view rendering completion time of the first view controller called by the application program; and acquiring the application process creation time of the application program, and acquiring the cold start time consumption of the application program according to the application process creation time and the view rendering completion time. According to the embodiment of the invention, the starting time consumption monitoring of the formally online application program in the terminal equipment of the user is realized, meanwhile, the monitoring of the time consumption behaviors of loading the executable file into the memory, linking the dynamic library and the like is ensured, and the accuracy of obtaining the starting time consumption is greatly improved.

Description

Method and device for acquiring starting time, terminal equipment and storage medium
Technical Field
The embodiment of the invention relates to a software development technology, in particular to a method and a device for acquiring starting time, terminal equipment and a storage medium.
Background
For Application programs (APPs) of the iOS system, the time consumption of the start phase is an important evaluation dimension in the software performance, and as the first phase of APP operation, the time consumption directly affects the user experience.
In the prior art, the starting time consumption of the APP in the iOS system is usually obtained by an integrated development tool Xcode and using an internal monitoring mechanism, or the starting time consumption of the APP is detected in real time by a pre-embedded point mode.
However, the integrated development tool Xcode can only be used in a Debug environment (i.e., a test environment), and cannot be applied to an APP which is formally online in a user terminal device; and by means of embedding points, the starting time consumption before the service code starts to be executed cannot be obtained, and the obtained starting time consumption result has a large error.
Disclosure of Invention
The embodiment of the invention provides a method and a device for acquiring the consumed starting time, terminal equipment and a storage medium, which are used for acquiring the consumed cold starting time of an application program according to the view rendering completion time of a first view controller called by the application program and the application process creation time of the application program.
In a first aspect, an embodiment of the present invention provides a method for obtaining time consumed by startup, including:
responding to the detected running instruction sent by the operating system, and acquiring the starting mode of the application program; wherein the starting mode comprises cold starting and hot starting;
if the starting mode of the application program is cold starting, acquiring the view rendering completion time of the first view controller called by the application program;
and acquiring the application process creation time of the application program, and acquiring the cold start time consumption of the application program according to the application process creation time and the view rendering completion time.
In a second aspect, an embodiment of the present invention provides a time-consuming starting acquisition apparatus, including:
the starting mode acquisition module is used for responding to the detected running instruction sent by the operating system and acquiring the starting mode of the application program; wherein the starting mode comprises cold starting and hot starting;
a rendering completion time acquisition module, configured to acquire a view rendering completion time of a first view controller called by the application program if the acquired starting mode of the application program is cold start;
and the cold-start time consumption acquisition module is used for acquiring the application process creation time of the application program and acquiring the cold-start time consumption of the application program according to the application process creation time and the view rendering completion time.
In a third aspect, an embodiment of the present invention further provides a terminal device, where the terminal device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for obtaining time-consuming start-up according to any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor implement the time-consuming starting and obtaining method according to any embodiment of the present invention.
In the embodiment of the invention, after the starting mode of the application program is cold starting, the view rendering completion time of the first view controller called by the application program and the application process creation time of the application program are respectively used as the starting point and the starting end point, so that the cold starting time consumption of the application program is obtained, the starting time consumption monitoring of the application program which is formally on-line in the terminal equipment of a user is realized, meanwhile, the monitoring of time consumption behaviors of loading an executable file into a memory, linking a dynamic library and the like is ensured, the time consumption value is closer to the waiting time of the user side, and the acquisition accuracy of the starting time consumption is greatly improved.
Drawings
Fig. 1 is a flowchart of a method for acquiring a start time according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for acquiring time consumed by starting according to a second embodiment of the present invention;
fig. 3 is a block diagram of a time-consuming starting acquisition apparatus according to a third embodiment of the present invention;
fig. 4 is a block diagram of a terminal device according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a method for acquiring startup time consumption according to an embodiment of the present invention, where the embodiment is applicable to acquiring cold startup time consumption of an application program according to an application process creation time and a view rendering completion time, and the method may be executed by an apparatus for acquiring startup time consumption according to an embodiment of the present invention, where the apparatus may be implemented by software and/or hardware and integrated into an application program, and the application program may be installed in a terminal device such as a mobile phone and a tablet computer, and the method specifically includes the following steps:
s110, responding to the detected running instruction sent by the operating system, and acquiring the starting mode of the application program; wherein the starting modes comprise cold starting and hot starting.
The application program is a program code to be executed, the terminal device creates a matched application Process (Process) for the application program to be started through the operating system, and then the application program is operated through the application Process; when the application program is switched to work in the background, the application process of the application program is changed into the background operation. After the terminal device obtains a starting instruction sent by a user, the terminal device executes the running of the application program in a mode of creating an application process or starting a background application process, and meanwhile, an operating system of the terminal device sends a running instruction to the application program.
When an application program acquires an operation instruction sent by an operating system, the starting mode of the application program can be determined according to whether a matched background application process exists, namely if the background application process matched with the application program does not exist, the acquired starting mode is cold starting, and if the background application process matched with the application program exists, the acquired starting mode is hot starting; the method comprises the following steps that hot start is carried out, namely a matched application process exists in an operating system, and the application process enters a foreground again from a background running state to run; and cold starting, namely, no matched application process exists in the operating system, and after the operating system needs to create the application process, executing the running of the application program through the created application process. In the embodiment of the invention, the operating system comprises an iOS system, the application program can be written and finished through Objective-C language (namely OC language), and the start-up time-consuming monitoring is put into code Runtime processing rather than compiling time processing based on a Runtime mechanism, so that the compiling efficiency of the code is improved.
And S120, if the starting mode of the application program is cold starting, obtaining the view rendering finishing moment of the first view controller called by the application program.
A View Controller (VC) is a container of views in a page, managing the View hierarchy and creating View objects that make up the hierarchy, and is responsible for handling events associated with the View objects in its hierarchy; and in the running process of the application program, rendering of each page is completed through a plurality of view controllers. The first view controller, namely the first view controller called after the application program is started; the application program calls back to obtain the occurrence time of view rendering completion (viewDidAppear) of the first view controller (FirstVC) through a Hook technology (namely a Hook function), namely, obtains the time node of occurrence of a' firstVC.
S130, acquiring the application process creation time of the application program, and acquiring the cold start time consumption of the application program according to the application process creation time and the view rendering completion time.
The application program obtains a time node when the application process is established through a Syscttl function, and the time node represents a starting time point of cold start of the application program; in the prior art, based on the time consumed for starting the embedded point, only the time after the service code starts to be executed can be acquired, that is, the embedded point can only be set in the code after the "main" function, but before the "main" function, for example, the time-consuming behaviors of loading an executable file into a memory, a dynamic library link and the like cannot be monitored, and actually, the behaviors are also part of the starting process of the application program; the technical scheme shows that in the embodiment of the invention, the creation time of the application process is used as the starting point for monitoring the starting time, the time consumed by the actions of loading the executable file into the memory, linking the dynamic library and the like is included, and the waiting time of the user side is reflected more accurately.
Optionally, in this embodiment of the present invention, after obtaining the view rendering completion time of the first view controller called by the application program, the method further includes: sending a registration application to the operating system so as to register a foreground running notification of the application program through the operating system; wherein the foreground running notification comprises an entering forenotice notification and an entering completion notification; after the starting mode of the application program is obtained, the method further comprises the following steps: and if the starting mode of the application program is acquired as the hot start, acquiring the time consumed by the hot start of the application program according to the foreground operation notice.
Specifically, in the process of executing cold start by an application program, an entry advance notice notification and an entry completion notification are registered in an operating system; wherein, entering a forenotice notice, namely 'uiapplicationwillenterterforegorrouund notification', is a notice sent by an operating system when an application process is about to enter a foreground; entering a completion notification, namely 'UIApplicationDidDecometActiveNotification', which is a notification sent by an operating system after an application process has entered a foreground; after the registration is completed, when the application process enters the foreground from the background running state, the time node for sending the notice by the operating system can be obtained, and the time node for sending the advance notice and the time node for sending the completion notice are respectively used as the starting time node and the completion time node of the hot start, so that the time consumed by the hot start of the application program is obtained.
Optionally, in this embodiment of the present invention, after obtaining that the starting manner of the application program is cold start, the method further includes: acquiring at least one of view loading execution time and view rendering starting time of a first view controller called by the application program and application code execution time of the application program; and acquiring the consumed time of each starting execution stage of the application program according to at least one of the view loading execution time, the view rendering starting time and the application code execution time, the view rendering finishing time and the application process creation time.
Specifically, the execution time of the application code is a time node when the code of the application program starts to be executed, and the execution time of the method of applying and dividing Launching actions is called back through the Hook technology and is used as the execution time of the application code; the view loading execution time is a time node for starting view loading (loadView) of a first view controller, and the execution time of the method of 'first VC, loadView' is called back through Hook technology to be used as the view loading execution time; the view rendering starting time is a time node at which a first view controller is to start view rendering (viewWillAppear), and the execution time of the method of 'firstvc. viewWillAppear' is called back by Hook technology to be used as the view rendering starting time; by acquiring the time nodes, the cold start process of the application program can be divided into different start execution stages according to different realized functions, so that the time consumption of different start execution stages can be acquired.
Optionally, in this embodiment of the present invention, the obtaining time consumed by each start execution phase of the application program according to at least one of the view loading execution time, the view rendering start time, and the application code execution time, and the view rendering completion time and the application process creation time includes at least one of: acquiring the time consumed by the system preparation stage of the application program according to the application process creation time and the application code execution time; acquiring the time consumed by the application preparation stage of the application program according to the execution time of the application code and the view loading execution time; acquiring the time consumed by the view loading stage of the application program according to the view loading execution time and the view rendering starting time; and acquiring the time consumed by the interaction preparation stage of the application program according to the view rendering starting time and the view rendering finishing time.
Specifically, the time consumed in the system preparation phase reflects the time consumed for the application program to be called by the operating system and loaded into the memory until the code in the executable file of the application program starts to be executed; the time consumption of the stage reflects whether the binary system arrangement in the application program is reasonable or not and whether the system dynamic library introduced by the application program is loaded normally or not; the time consumption of the application preparation stage reflects the time consumption that the codes in the executable file of the application program start to execute until the view is prepared to be loaded; the time consumption of the stage represents the time consumption of an initialization process after an application program starts to execute a code, and the time consumption conditions including reading and writing of initialization configuration, data preparation and processing and the like are normal or not; the time consumption of the view loading stage reflects the time consumption from the loading of the view to the display of the view; the time consumed in this stage represents whether the initialization of the first view of the application program is normal, for example, the initialization of a view UI (User Interface) control, the reading and writing of data to be displayed and the preparation of the view; the interaction preparation phase is time-consuming, and reflects the time consumption from rendering of the view to rendering of the view; the time consumption of the stage reflects the rendering condition of the first view of the application program and whether the time consumption of business logic such as data processing and the like is normal or not in the rendering process.
Optionally, in the embodiment of the present invention, after obtaining time consumed by each start execution phase of the application program, the method further includes: and obtaining the evaluation result of each starting execution stage of the application program according to the time consumption of each starting execution stage of the application program and a preset stage time consumption threshold. And presetting different stage time-consuming thresholds at different starting execution stages, if the actual time consumption of the starting execution stage is greater than the preset stage time-consuming threshold at the stage, indicating that the starting execution stage is abnormal, and sending an abnormal prompt to the server according to the service logic related to each starting execution stage disclosed by the technical scheme so as to prompt the server to generate the reason of the abnormality. By taking the above technical solution as an example, if the time consumption of the system preparation phase is greater than the time consumption threshold of the preset phase of the system preparation phase, it is determined that there is an abnormality in the system preparation phase of the application program, and since the time consumption of the system preparation phase is related to the binary arrangement in the application program and the loading of the system dynamic library referred to by the application program, the abnormality in the system preparation phase is sent to the server, and the unreasonable binary arrangement of the application program and the abnormal loading of the system dynamic library referred to by the application program are used as the cause of the abnormality in the phase.
Particularly, summing the time consumed by the system preparation stage, the application preparation stage, the view loading stage and the interaction preparation stage, wherein the summation result is the time consumed by the cold start of the application program; summing the time-consuming thresholds of the preset stages corresponding to the system preparation stage, the application preparation stage, the view loading stage and the interaction preparation stage respectively, wherein the summation result is the cold-start time-consuming threshold of the application program; and comparing the actual cold start time consumption of the application program with the cold start time consumption threshold value, so as to determine whether the time consumption of the cold start process of the application program is abnormal.
Optionally, in this embodiment of the present invention, after obtaining that the starting manner of the application program is cold start, the method further includes: acquiring execution time consumption and preset execution time consumption threshold values of a plurality of service execution methods; the execution time consumption is matched with the preset execution time consumption threshold one by one; judging whether a target service execution method exists in the plurality of service execution methods; wherein the execution time consumption of the target service execution method is greater than the matching preset execution time threshold; and if the target service execution method exists in the plurality of service execution methods, sending a time-consuming abnormity prompt of the target service execution method to a server.
Specifically, the service execution method is a method for executing various service logics called by the application program in the starting process, and may include a "viewwilldispear" method and a "viewdiddispear" method related to the view lifecycle in addition to the various methods disclosed in the above technical solutions; a "UIImage imagename" method and a "UIImage initWithData" method and the like related to image rendering; the method of "NSData DataWithContentOfFile" and the method of "NSData DataWithContentOfFile" related to binary read-write; the "NSJSON Serialization JSONObjectWithData" method for options: error "and the" NSJSON Serialization JSONObject: error "method, etc. related to JSON Serialization; the "FMDatabase executeQuery: without alignment InAlrray: ordectionary: orVAList" method and the "FMDatabase executeUpdate: error: without alignment InAlrray: ordatast" method and the like are related to database reading and writing. And presetting a matched execution time-consuming threshold for each service execution method, comparing the execution time-consuming with the matched preset execution time-consuming threshold after the actual execution time-consuming of each service execution method is obtained through callback, if the execution time-consuming of the service execution method is larger than the matched execution time-consuming threshold, indicating that time-consuming abnormity exists in the execution process of the service execution method, and accordingly, sending a time-consuming abnormity prompt of the service execution method to a server.
Optionally, in this embodiment of the present invention, after determining that a target service execution method exists in the plurality of service execution methods, the method further includes: determining a target starting execution stage to which the target service execution method belongs according to the execution time consumption of the target service execution method; and if the time-consuming abnormity exists in the target starting execution stage, taking the time-consuming abnormity of the target service execution method as a time-consuming abnormity reason of the target starting execution stage.
Specifically, the execution time consumption of the target service execution method includes a start execution time and an end execution time of the target service execution method, and the start execution stage to which each target service execution method belongs may be determined according to the time node, where, taking the above technical solution as an example, the start execution stage may include a system preparation stage time consumption, an application preparation stage time consumption, a view loading stage time consumption, and an interaction preparation stage time consumption; if the service execution method itself has time-consuming abnormity and the start execution stage to which the service execution method belongs also has time-consuming abnormity, the service execution method can be directly used as the time-consuming abnormity reason of the start execution stage, the accurate time-consuming abnormity reason of each start execution stage is further obtained, and the time-consuming abnormity reason is sent to the server.
In the embodiment of the invention, after the starting mode of the application program is cold starting, the view rendering completion time of the first view controller called by the application program and the application process creation time of the application program are respectively used as the starting point and the starting end point, so that the cold starting time consumption of the application program is obtained, the starting time consumption monitoring of the application program which is formally on-line in the terminal equipment of a user is realized, meanwhile, the monitoring of time consumption behaviors of loading an executable file into a memory, linking a dynamic library and the like is ensured, the time consumption value is closer to the waiting time of the user side, and the acquisition accuracy of the starting time consumption is greatly improved.
Example two
Fig. 2 is a flowchart of a method for acquiring time consumed for starting according to a second embodiment of the present invention, which is embodied on the basis of the foregoing technical solution, and specifically, the method includes the following steps:
s210, responding to the detected running instruction sent by the operating system, and acquiring the starting mode of the application program; wherein the starting modes comprise cold starting and hot starting.
S220, if the starting mode of the application program is cold starting, acquiring the application process creating time and the application code executing time of the application program, and the view loading executing time, the view rendering starting time and the view rendering finishing time of the first view controller called by the application program.
S230, acquiring the consumed time of the system preparation stage of the application program according to the application process creation time and the application code execution time; acquiring the time consumed by the application preparation stage of the application program according to the execution time of the application code and the view loading execution time; acquiring the time consumed by the view loading stage of the application program according to the view loading execution time and the view rendering starting time; and acquiring the time consumed by the interaction preparation stage of the application program according to the view rendering starting time and the view rendering finishing time.
S240, obtaining evaluation results of the application program in the system preparation stage, the application preparation stage, the view loading stage and the interaction preparation stage according to the time consumption of the system preparation stage, the time consumption of the application preparation stage, the time consumption of the view loading stage and the time consumption of the interaction preparation stage and a preset stage time consumption threshold.
And S250, acquiring the cold start time consumption according to the system preparation phase time consumption, the application preparation phase time consumption, the view loading phase time consumption and the interaction preparation phase time consumption.
In the embodiment of the invention, after the starting mode of the application program is obtained to be cold starting, the time consumption monitoring of each starting execution stage of the application program is further realized by obtaining the application process creation time and the application code execution time of the application program, and the view loading execution time, the view rendering start time and the view rendering completion time of the first view controller called by the application program, and obtaining the time consumption of a system preparation stage, the time consumption of an application preparation stage, the time consumption of a view loading stage and the time consumption of an interaction preparation stage.
EXAMPLE III
Fig. 3 is a block diagram of a structure of a time-consuming starting acquisition apparatus according to a third embodiment of the present invention, where the apparatus specifically includes: a starting mode obtaining module 310, a rendering completion time obtaining module 320 and a cold start time consumption obtaining module 330.
A starting mode obtaining module 310, configured to obtain a starting mode of the application program in response to detecting an operation instruction sent by an operating system; wherein the starting mode comprises cold starting and hot starting;
a rendering completion time obtaining module 320, configured to obtain, if the starting mode of the application program is cold start, a view rendering completion time of a first view controller called by the application program;
a cold-start time consumption obtaining module 330, configured to obtain an application process creation time of the application program, and obtain a cold-start time consumption of the application program according to the application process creation time and the view rendering completion time.
In the embodiment of the invention, after the starting mode of the application program is cold starting, the view rendering completion time of the first view controller called by the application program and the application process creation time of the application program are respectively used as the starting point and the starting end point, so that the cold starting time consumption of the application program is obtained, the starting time consumption monitoring of the application program which is formally on-line in the terminal equipment of a user is realized, meanwhile, the monitoring of time consumption behaviors of loading an executable file into a memory, linking a dynamic library and the like is ensured, the time consumption value is closer to the waiting time of the user side, and the acquisition accuracy of the starting time consumption is greatly improved.
Optionally, on the basis of the above technical solution, starting the time-consuming acquiring device further includes:
a foreground operation notification registration module, configured to send a registration application to the operating system, so as to register a foreground operation notification of the application program through the operating system; wherein the foreground running notification comprises an entering forenotice notification and an entering completion notification;
and the hot start time consumption acquisition module is used for acquiring the hot start time consumption of the application program according to the foreground operation notice if the starting mode of the application program is the hot start.
Optionally, on the basis of the above technical solution, starting the time-consuming acquiring device further includes:
an execution time acquisition module, configured to acquire at least one of a view loading execution time and a view rendering start time of a first view controller called by the application program, and an application code execution time of the application program;
and the phase time consumption acquisition module is used for acquiring the time consumption of each starting execution phase of the application program according to at least one of the view loading execution time, the view rendering starting time and the application code execution time, the view rendering finishing time and the application process creation time.
Optionally, on the basis of the above technical solution, the stage time consumption obtaining module includes at least one of the following modules;
a system preparation phase time consumption obtaining unit, configured to obtain the system preparation phase time consumption of the application program according to the application process creation time and the application code execution time;
the application preparation phase time consumption acquisition unit is used for acquiring the application preparation phase time consumption of the application program according to the application code execution time and the view loading execution time;
a view loading phase time consumption obtaining unit, configured to obtain, according to the view loading execution time and the view rendering start time, a view loading phase time consumption of the application program;
and the interaction preparation phase time consumption acquisition unit is used for acquiring the interaction preparation phase time consumption of the application program according to the view rendering starting time and the view rendering finishing time.
Optionally, on the basis of the above technical solution, starting the time-consuming acquiring device further includes:
and the evaluation result acquisition module is used for acquiring the evaluation result of each starting execution stage of the application program according to the time consumption of each starting execution stage of the application program and a preset stage time consumption threshold.
Optionally, on the basis of the above technical solution, starting the time-consuming acquiring device further includes:
the execution time consumption acquisition module is used for acquiring execution time consumption of a plurality of service execution methods and a preset execution time consumption threshold; the execution time consumption is matched with the preset execution time consumption threshold one by one;
a service execution method judgment module, configured to judge whether a target service execution method exists in the plurality of service execution methods; wherein the execution time consumption of the target service execution method is greater than the matching preset execution time threshold;
and the time-consuming abnormity prompt sending module is used for sending a time-consuming abnormity prompt of the target service execution method to the server if the target service execution method is determined to exist in the plurality of service execution methods.
Optionally, on the basis of the above technical solution, starting the time-consuming acquiring device further includes:
a target phase acquisition module, configured to determine, according to execution time consumption of the target service execution method, a target start execution phase to which the target service execution method belongs;
and a time-consuming exception reason acquisition module, configured to, if the target start execution stage has a time-consuming exception, use the time-consuming exception of the target service execution method as a time-consuming exception reason of the target start execution stage.
The device can execute the time-consuming starting acquisition method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. For details of the technique not described in detail in this embodiment, reference may be made to the time-consuming start-up obtaining method provided in any embodiment of the present invention.
Example four
Fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present invention. Fig. 4 shows a block diagram of an exemplary terminal device 12 suitable for use in implementing embodiments of the present invention. The terminal device 12 shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 4, the terminal device 12 is in the form of a general-purpose computer device. The components of terminal device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 that couples various system components including the memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Terminal device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by terminal device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Terminal device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Terminal device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with terminal device 12, and/or with any devices (e.g., network card, modem, etc.) that enable terminal device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, terminal device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via network adapter 20. As shown, the network adapter 20 communicates with the other modules of the terminal device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with terminal device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the memory 28, for example, to implement the time-consuming acquisition method for startup provided by the embodiment of the present invention. Namely: responding to the detected running instruction sent by the operating system, and acquiring the starting mode of the application program; wherein the starting mode comprises cold starting and hot starting; if the starting mode of the application program is cold starting, acquiring the view rendering completion time of the first view controller called by the application program; and acquiring the application process creation time of the application program, and acquiring the cold start time consumption of the application program according to the application process creation time and the view rendering completion time.
EXAMPLE five
The fifth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for obtaining the time consumed for starting according to any embodiment of the present invention; the method comprises the following steps:
responding to the detected running instruction sent by the operating system, and acquiring the starting mode of the application program; wherein the starting mode comprises cold starting and hot starting;
if the starting mode of the application program is cold starting, acquiring the view rendering completion time of the first view controller called by the application program;
and acquiring the application process creation time of the application program, and acquiring the cold start time consumption of the application program according to the application process creation time and the view rendering completion time.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having 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. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for obtaining time-consuming starting is characterized by comprising the following steps:
responding to the detected running instruction sent by the operating system, and acquiring the starting mode of the application program; wherein the starting mode comprises cold starting and hot starting;
if the starting mode of the application program is cold starting, acquiring the view rendering completion time of the first view controller called by the application program;
and acquiring the application process creation time of the application program, and acquiring the cold start time consumption of the application program according to the application process creation time and the view rendering completion time.
2. The method of claim 1, after obtaining a view rendering completion time of a first view controller invoked by the application, further comprising:
sending a registration application to the operating system so as to register a foreground running notification of the application program through the operating system; wherein the foreground running notification comprises an entering forenotice notification and an entering completion notification;
after the starting mode of the application program is obtained, the method further comprises the following steps:
and if the starting mode of the application program is acquired as the hot start, acquiring the time consumed by the hot start of the application program according to the foreground operation notice.
3. The method according to claim 1, wherein after acquiring that the starting mode of the application program is cold start, the method further comprises:
acquiring at least one of view loading execution time and view rendering starting time of a first view controller called by the application program and application code execution time of the application program;
and acquiring the consumed time of each starting execution stage of the application program according to at least one of the view loading execution time, the view rendering starting time and the application code execution time, the view rendering finishing time and the application process creation time.
4. The method according to claim 3, wherein the obtaining the consumed time of each starting execution phase of the application program according to at least one of the view loading execution time, the view rendering start time, and the application code execution time, and the view rendering completion time and the application process creation time includes at least one of:
acquiring the time consumed by the system preparation stage of the application program according to the application process creation time and the application code execution time;
acquiring the time consumed by the application preparation stage of the application program according to the execution time of the application code and the view loading execution time;
acquiring the time consumed by the view loading stage of the application program according to the view loading execution time and the view rendering starting time;
and acquiring the time consumed by the interaction preparation stage of the application program according to the view rendering starting time and the view rendering finishing time.
5. The method according to claim 3 or 4, further comprising, after obtaining the elapsed time of each execution phase of the application program, the following steps:
and obtaining the evaluation result of each starting execution stage of the application program according to the time consumption of each starting execution stage of the application program and a preset stage time consumption threshold.
6. The method according to claim 3, wherein after acquiring that the starting mode of the application program is cold starting, the method further comprises:
acquiring execution time consumption and preset execution time consumption threshold values of a plurality of service execution methods; the execution time consumption is matched with the preset execution time consumption threshold one by one;
judging whether a target service execution method exists in the plurality of service execution methods; wherein the execution time consumption of the target service execution method is greater than the matching preset execution time threshold;
and if the target service execution method exists in the plurality of service execution methods, sending a time-consuming abnormity prompt of the target service execution method to a server.
7. The method of claim 6, after determining that a target service execution method exists in the plurality of service execution methods, further comprising:
determining a target starting execution stage to which the target service execution method belongs according to the execution time consumption of the target service execution method;
and if the time-consuming abnormity exists in the target starting execution stage, taking the time-consuming abnormity of the target service execution method as a time-consuming abnormity reason of the target starting execution stage.
8. A time-consuming acquisition device, comprising:
the starting mode acquisition module is used for responding to the detected running instruction sent by the operating system and acquiring the starting mode of the application program; wherein the starting mode comprises cold starting and hot starting;
a rendering completion time acquisition module, configured to acquire a view rendering completion time of a first view controller called by the application program if the acquired starting mode of the application program is cold start;
and the cold-start time consumption acquisition module is used for acquiring the application process creation time of the application program and acquiring the cold-start time consumption of the application program according to the application process creation time and the view rendering completion time.
9. A terminal device, characterized in that the terminal device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the startup time-consuming acquisition method of any one of claims 1-7.
10. A storage medium containing computer-executable instructions for performing the boot-time acquisition method of any one of claims 1-7 when executed by a computer processor.
CN202111473492.2A 2021-11-29 2021-11-29 Method and device for acquiring time consumption during starting, terminal equipment and storage medium Active CN114168222B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111473492.2A CN114168222B (en) 2021-11-29 2021-11-29 Method and device for acquiring time consumption during starting, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111473492.2A CN114168222B (en) 2021-11-29 2021-11-29 Method and device for acquiring time consumption during starting, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114168222A true CN114168222A (en) 2022-03-11
CN114168222B CN114168222B (en) 2023-10-17

Family

ID=80483065

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111473492.2A Active CN114168222B (en) 2021-11-29 2021-11-29 Method and device for acquiring time consumption during starting, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114168222B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115016866A (en) * 2022-08-09 2022-09-06 荣耀终端有限公司 Data processing method during application starting, electronic equipment and storage medium
CN115499645A (en) * 2022-08-31 2022-12-20 重庆长安汽车股份有限公司 Method and device for optimizing starting speed of vehicle-mounted image, vehicle terminal and medium
CN116662150A (en) * 2022-12-15 2023-08-29 荣耀终端有限公司 Application starting time-consuming detection method and related device
CN117149632A (en) * 2023-08-31 2023-12-01 重庆赛力斯新能源汽车设计院有限公司 Method and device for analyzing cold start of vehicle-mounted application program
CN117493127A (en) * 2023-12-29 2024-02-02 太平金融科技服务(上海)有限公司 Application program detection method, device, equipment and medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105573755A (en) * 2015-12-15 2016-05-11 北京奇虎科技有限公司 Method and device for acquiring application Activity rendering time
US9600400B1 (en) * 2015-10-29 2017-03-21 Vertafore, Inc. Performance testing of web application components using image differentiation
CN109976966A (en) * 2017-12-27 2019-07-05 阿里巴巴集团控股有限公司 A kind of application program launching time counting method, apparatus and system
CN110781067A (en) * 2019-10-30 2020-02-11 北京博睿宏远数据科技股份有限公司 Method, device, equipment and storage medium for calculating starting time consumption
WO2020056878A1 (en) * 2018-09-21 2020-03-26 网宿科技股份有限公司 Method for acquiring launching duration of application interface, apparatus, and terminal device
CN111352791A (en) * 2018-12-20 2020-06-30 深圳市优必选科技有限公司 System application detection method and device, terminal equipment and storage medium
WO2020187121A1 (en) * 2019-03-15 2020-09-24 上海连尚网络科技有限公司 Applet start method, device, and computer storage medium
CN112783761A (en) * 2020-12-25 2021-05-11 广州品唯软件有限公司 Method, device and system for testing cold start duration of application program

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9600400B1 (en) * 2015-10-29 2017-03-21 Vertafore, Inc. Performance testing of web application components using image differentiation
CN105573755A (en) * 2015-12-15 2016-05-11 北京奇虎科技有限公司 Method and device for acquiring application Activity rendering time
CN109976966A (en) * 2017-12-27 2019-07-05 阿里巴巴集团控股有限公司 A kind of application program launching time counting method, apparatus and system
WO2020056878A1 (en) * 2018-09-21 2020-03-26 网宿科技股份有限公司 Method for acquiring launching duration of application interface, apparatus, and terminal device
CN111352791A (en) * 2018-12-20 2020-06-30 深圳市优必选科技有限公司 System application detection method and device, terminal equipment and storage medium
WO2020187121A1 (en) * 2019-03-15 2020-09-24 上海连尚网络科技有限公司 Applet start method, device, and computer storage medium
CN110781067A (en) * 2019-10-30 2020-02-11 北京博睿宏远数据科技股份有限公司 Method, device, equipment and storage medium for calculating starting time consumption
CN112783761A (en) * 2020-12-25 2021-05-11 广州品唯软件有限公司 Method, device and system for testing cold start duration of application program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
董慧 等: "APP软件性能效率研究", 计算机工程与应用, vol. 55, no. 10, pages 45 - 52 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115016866A (en) * 2022-08-09 2022-09-06 荣耀终端有限公司 Data processing method during application starting, electronic equipment and storage medium
CN115499645A (en) * 2022-08-31 2022-12-20 重庆长安汽车股份有限公司 Method and device for optimizing starting speed of vehicle-mounted image, vehicle terminal and medium
CN116662150A (en) * 2022-12-15 2023-08-29 荣耀终端有限公司 Application starting time-consuming detection method and related device
CN117149632A (en) * 2023-08-31 2023-12-01 重庆赛力斯新能源汽车设计院有限公司 Method and device for analyzing cold start of vehicle-mounted application program
CN117493127A (en) * 2023-12-29 2024-02-02 太平金融科技服务(上海)有限公司 Application program detection method, device, equipment and medium
CN117493127B (en) * 2023-12-29 2024-04-05 太平金融科技服务(上海)有限公司 Application program detection method, device, equipment and medium

Also Published As

Publication number Publication date
CN114168222B (en) 2023-10-17

Similar Documents

Publication Publication Date Title
CN114168222B (en) Method and device for acquiring time consumption during starting, terminal equipment and storage medium
US8122176B2 (en) System and method for logging system management interrupts
US9870314B1 (en) Update testing by build introspection
CN111694684B (en) Abnormal construction method and device of storage device, electronic device and storage medium
CN113315675B (en) White box switch U-Boot automatic testing method, system and storage medium
CN110781075A (en) Method, device and system for detecting memory leakage and storage medium
CN116662039B (en) Industrial information parallel detection method, device and medium based on shared memory
CN115656788B (en) Chip testing system, method, equipment and storage medium
US10802901B2 (en) Obtaining state information of threads of a device
CN115145381A (en) Method, system, storage medium and equipment for remotely resetting BMC chip
CN114116034A (en) Distributed flashing method and device
CN113742224A (en) Test system, method, device, computer equipment and storage medium
CN113392002A (en) Test system construction method, device, equipment and storage medium
CN113760631A (en) Page loading duration determination method, device, equipment and storage medium
CN110968519A (en) Game testing method, device, server and storage medium
US10102109B2 (en) Exception resolution in a software development session
CN112181761B (en) Program execution control method, program execution test device, code detection device, program execution equipment and medium
CN112416695B (en) Global variable monitoring method, device, equipment and storage medium
US11726901B2 (en) Continuous testing and dependency tracking for java virtual machines
CN116737430A (en) BMC control method and device, electronic equipment and storage medium
CN112286804B (en) System debugging method, device, equipment and medium
CN111240928B (en) Automatic detection method, device, equipment and storage medium for equipment drive
CN114816433A (en) Encoding method, system, device and medium in project based on asynchronous programming
CN114780347A (en) Monitoring method, monitoring device, computer equipment and storage medium
CN117234601A (en) System starting method and device, electronic 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
GR01 Patent grant
GR01 Patent grant