CN110888740B - Incremental memory determining method, device and equipment of small program and storage medium - Google Patents

Incremental memory determining method, device and equipment of small program and storage medium Download PDF

Info

Publication number
CN110888740B
CN110888740B CN201911155560.3A CN201911155560A CN110888740B CN 110888740 B CN110888740 B CN 110888740B CN 201911155560 A CN201911155560 A CN 201911155560A CN 110888740 B CN110888740 B CN 110888740B
Authority
CN
China
Prior art keywords
memory
target
applet
small program
activation time
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.)
Active
Application number
CN201911155560.3A
Other languages
Chinese (zh)
Other versions
CN110888740A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201911155560.3A priority Critical patent/CN110888740B/en
Publication of CN110888740A publication Critical patent/CN110888740A/en
Application granted granted Critical
Publication of CN110888740B publication Critical patent/CN110888740B/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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Abstract

The application provides a method, a device and equipment for determining an incremental memory of an applet and a storage medium, relates to the technical field of computers, and aims to improve the accuracy of evaluating the memory overhead of the applet operation. The method comprises the following steps: acquiring the activation time of a target small program process, wherein the target small program process is a process for loading a target small program; acquiring a reference memory of the target small program process at the activation time; acquiring a process memory in the process of running the target applet; and determining the difference value between the process memory and the reference memory as an increment memory of the target applet, wherein the increment memory represents memory overhead occupied by the target applet during operation. According to the method, when the incremental memory consumed by the running of the small program is evaluated, the memory overhead which does not belong to the target small program in the process of the target small program is excluded, and the accuracy of evaluating the memory consumption of the running of the small program is improved.

Description

Incremental memory determining method, device and equipment of small program and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for determining an incremental memory of an applet.
Background
With the development of computer technology, an applet appears, which is an application that runs in a browser or an application APP through HTML5 technology and the like, can be used without downloading and installing, can be randomly added according to product requirements, and is more and more popular; the small program also occupies a certain memory overhead during operation, the memory overhead of the small program operation is evaluated by the whole memory consumed by the process for loading the small program, but the whole memory consumed by the process for operating the small program also comprises a plurality of memory overheads which are not consumed by the small program, such as the memory overhead of the process, the memory overhead of a base library, the memory overhead of a browser component such as Webview, and the like, and further the error of the memory overhead of the small program operation is evaluated by the whole memory consumed by the process is large.
Disclosure of Invention
The embodiment of the application provides a method, a device, equipment and a storage medium for determining an incremental memory of an applet, which are used for improving the accuracy of evaluating the memory overhead of the applet.
In a first aspect of the present application, a method for determining an incremental memory of an applet is provided, including:
acquiring the activation time of a target small program process, wherein the target small program process is a process for loading a target small program;
acquiring a reference memory of the target applet process at the activation time;
acquiring a process memory in the running process of the target small program process; and
and determining the difference value between the process memory and the reference memory as an increment memory of the target small program, wherein the increment memory represents memory overhead occupied by the target small program during operation.
In a second aspect of the present application, an incremental memory determining apparatus for an applet is provided, including:
the activation time determining unit is used for acquiring the activation time of a target small program process, wherein the target small program process is a process for loading a target small program;
a reference memory obtaining unit, which is used for obtaining a reference memory of the target small program process at the activation time by a user;
a process memory obtaining unit, configured to obtain a process memory in the process of running the target applet; and
and the incremental memory determining unit is used for determining that the difference value between the process memory and the reference memory is the incremental memory of the target applet, and the incremental memory represents the memory overhead occupied by the target applet during operation.
As a possible implementation manner, the process memory obtaining unit is specifically configured to send, through a communication interface, a plurality of memory obtaining instructions to a client that runs the target applet process in a running process of the target applet process, and obtain, by the plurality of memory obtaining instructions, a plurality of process memories of the target applet process at different times; and
the incremental memory determining unit is specifically configured to determine a difference between each process memory and the reference memory, and obtain a plurality of incremental memories of the target applet at different times.
As a possible implementation, the target applet process is a target sub-process for loading the target applet;
the reference memory of the target small program process at the activation time is the memory of the target sub-process at the activation time;
and the process memory in the running process of the target small program process is the memory of the target sub-process in the running process.
As a possible implementation manner, the activation time determining unit is configured to send an activation process detection instruction to a client running the target applet process through the communication interface, and obtain the activation time of the target applet process.
As a possible implementation, the activation time determination unit is configured to:
monitoring a preset key event through a log grabbing tool;
and determining the time when the preset key event is monitored as the activation time of the target small program process.
As a possible implementation, the target applet process is a target host process that loads the target applet;
the reference memory of the target small program process at the activation time is the memory of the target main process at the activation time;
and the process memory in the process of running the target small program is the memory in the process of running the target small program for the target main process.
As a possible implementation, the activation time determination unit is configured to:
acquiring the starting time of the target applet;
determining the starting time as the activation time of the target applet process.
In a third aspect of the present application, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of the first aspect and any one of the possible embodiments when executing the program.
In a fourth aspect of the present application, a computer-readable storage medium is provided, which stores computer instructions that, when executed on a computer, cause the computer to perform the method according to the first aspect and any one of the possible embodiments.
Due to the adoption of the technical scheme, the embodiment of the application at least has the following technical effects:
in the method, the memory of the target small program process at the activation time is used as a reference memory, the difference value between the process memory and the reference memory is used as an incremental memory consumed during the operation of the target small program, the memory overhead which does not belong to the target small program in the target small program process is excluded, the memory consumption of the operation of the target small program is evaluated by the incremental memory, and the accuracy of evaluating the memory overhead of the operation of the small program is improved.
Drawings
Fig. 1 is a schematic diagram of a processing mechanism for detecting a client according to an embodiment of the present disclosure;
fig. 2 is a diagram illustrating a scenario for determining an incremental memory of an applet according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a command line window of a detection client according to an embodiment of the present disclosure;
fig. 4 is a process diagram of an incremental memory determination method for an applet according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a method for determining an incremental memory of a mini-game in an instant messaging application according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram illustrating a process of determining an incremental memory of a mini-game for an instant messenger application through an ADB tool according to an embodiment of the present application;
FIG. 7 is a schematic diagram illustrating another embodiment of the present disclosure for determining incremental memory for a mini-game in an instant messaging application;
FIG. 8 is a diagram illustrating another process for determining incremental memory for a mini-game for an instant messenger application via an ADB tool according to an embodiment of the present disclosure;
FIG. 9 is a schematic diagram illustrating a principle of determining an incremental memory of a mini-game in a handheld game application according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a process for determining incremental memory of a mini-game of a handheld game application by an ADB tool according to an embodiment of the present application;
FIG. 11 is a diagram illustrating incremental memory of a certain applet, according to an embodiment of the present disclosure;
fig. 12 is a schematic structural diagram of an incremental memory determining apparatus of an applet according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of another incremental memory determining apparatus for an applet according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In order to better understand the technical solutions provided by the embodiments of the present application, the following detailed description is made with reference to the drawings and specific embodiments.
In order to facilitate those skilled in the art to better understand the technical solutions of the present application, the following description refers to the terms used in the present application.
The terminal equipment: may be a mobile terminal, a fixed terminal, or a portable terminal such as a mobile handset, station, unit, device, multimedia computer, multimedia tablet, internet node, communicator, desktop computer, laptop computer, notebook computer, netbook computer, tablet computer, Personal Communication System (PCS) device, personal navigation device, Personal Digital Assistant (PDA), audio/video player, digital camera/camcorder, positioning device, television receiver, radio broadcast receiver, electronic book device, game device, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof.
Small program container: the method comprises the steps of running an application APP of an applet, providing a webevew component for running an H5 application, wherein common applet containers comprise an instant messaging application, a palm game application, an instant messaging application game and the like; the small program may run in a main process in the small program container or in a subprocess in the small program container, and different applications are implemented differently, for example, an instant messaging application creates a subprocess as a small program process, and in a certain handheld game application, the small program can only run in the main process.
The following explains the concept of the present application.
The application APP runs in an independent process, a process memory consumed during the running of the application APP is exclusive to the application, the size of the process memory reflects the resource occupation and the memory overhead during the running of the application APP, and the client performance of the application APP can be accurately evaluated by testing the process memory of the application APP.
However, the memory overhead of the small program in operation is different from that of the application APP in operation, and the small program runs in the Webview of the process of the small program container, which may be the Webview of the main process or the Webview of the subprocess; if the memory consumed by the applet operation is evaluated by using the process memory of the applet operation process, the memory overhead may affect the accuracy of evaluating the memory overhead of the applet operation because the process memory includes memory overhead other than the applet, such as memory overhead of loading a base library, memory overhead of Webview, and the like.
In view of this, the inventor designs a method, an apparatus, a device, and a storage medium for determining an incremental memory of an applet, where the method includes acquiring activation time of a target applet process, and further acquiring a memory of the target applet process at the activation time as a basic memory; acquiring a process memory of a target applet in the process running process of the target applet; and taking the obtained difference value between the city-entering memory and the basic memory as an increment memory of the target small program, wherein the increment memory represents memory overhead occupied by the target small program during operation.
The target applet process is a process for loading a target applet, which may be, but is not limited to, a game applet, a shopping applet, a reading information applet, and the like.
The target applet runs in the applet container, and the reference memory represents the size of the memory of the process before the target applet runs, wherein the applet container finishes loading of the basic library; the method comprises the steps that a target small program is opened by a user, and a target small program page is displayed for the first time, wherein the processes of basic library loading, target small program code package downloading, code execution, page rendering and the like of the target small program are generally included; and gradually increasing the memory overhead when each step is executed, wherein the reference memory is the memory overhead of the target small program process when the small program container finishes basic library loading but does not download the code packet of the target small program.
The applet container needs to provide various capabilities for the target applet to run, such as page rendering, JavaScript execution environment, Application Programming Interface (API) of the local service, and the like. These capabilities are provided through a base library in the applet container, which includes, for example, an applet for an instant messaging application, an explorer framework that provides page rendering, built-in components such as forms, media, maps, etc., local service APIs such as web access, files, locations, etc., other custom components and plug-ins, etc. The underlying library of different applet containers varies but functions similarly. The base library is typically built into the applet container and is loaded and initialized prior to opening the target applet to prepare the execution environment for the target applet to run.
In order to more clearly understand the design idea of the present application, an example of a processing mechanism for detecting a client is described below.
Referring to fig. 1, a processing mechanism diagram of a detection client is shown, or an internal architecture diagram of a terminal device may also be shown. In fig. 1, a detection client 120 detects a reference memory and a process memory of a target applet. After the user installs the detected client 110, the detecting client 120 may obtain the basic information of the detected client 110 through a communication interface, where the detecting client 120 and the detected client 110 may be installed on a terminal device, for example, when the terminal device is a computer, so as to install the detecting client 120 and the detected client 110 in the computer at the same time, and at this time, the communication interface may be an application list GetApplist interface in the terminal device; the detection client 120 and the detection client 110 may also be on different terminal devices, and the communication interface in this case may be a USB interface.
The basic information includes a package name, and the package name refers to a name of an installation package corresponding to the client. The basic information may further include one or more of an application name, an application icon, process information of the process of the detected client 110, and the like. After the detection client 120 obtains the basic information, the detection client 120 may display the basic information of the detected client 110 on its interface.
When a user wants to detect the incremental memory of the applet, the user may open the detected client 110 in the detection client 120, for example, the user may click on the detected client 110, and the like, where the detected client 110 may be any type of client, such as a game client, a video client, a query information type application client, and the like, and the specific type of the detected client 110 is not limited in this application.
After introducing the design concept of the embodiment of the present application, some simple descriptions are provided below for application scenarios to which the technical solution of the embodiment of the present application can be applied, and it should be noted that the application scenarios described below are only used for describing the embodiment of the present application and are not limited. In a specific implementation process, the technical scheme provided by the embodiment of the application can be flexibly applied according to actual needs.
Referring to fig. 2, an exemplary application scenario is shown, where the application scenario includes a plurality of terminal devices 100, some terminal devices 100 are installed with a detection client 120, some terminal devices are installed with a detected client 110, and the detection client 120 and the detected client 110 communicate through a communication interface.
The detected client 110 has an application capable of running the target applet installed therein, and the target applet can be run in a process corresponding to the application.
The detection client 120 may detect a reference memory of the target applet process at the activation time and a process memory in the running process, and further determine an incremental memory of the target applet according to the reference memory and the process memory, where the target applet process is a process for loading the target applet and may be a main process or a sub-process of an application.
When the detected client 110 is a mobile phone, the detecting client 120 may be an assisted mobile phone (ADB) tool, the ADB tool is a command line window, see fig. 3, the command line window is an instruction operation interface, and may interact with a simulator or a real device through a terminal device such as a computer, a technician may input an operation instruction to the command line window and send the operation instruction to the detected client 110, and the detected client 110 may send some information responding to the operation instruction or information such as a log output by the detected client to the command line window for display, such as the command line window shown in fig. 3, where "C: \ User \ Administrator Desktop \ platform-tools > ADB xxxxx" in the "indicates the operation instruction sent by the ADB tool to the mobile phone.
The incremental memory determining method for the applet, which is related in the embodiment of the application, can be suitable for detecting the incremental memory of the applet in real time in the applet using process of a user, and can also be suitable for the applet testing process, so that a worker can conveniently know the incremental memory consumed by the applet in operation.
Based on the application scenario of fig. 2, an incremental memory determination method for an applet designed in the embodiment of the present application is exemplarily described below.
Referring to fig. 4, a schematic process diagram of a method for determining an incremental memory of an applet, which is applied to a detection client, is provided, and the method includes:
step S401, obtains the activation time of the target applet process.
The target applet process may be a target sub-process for loading the target applet or may be a target main process for loading the target applet.
As an embodiment, when the target applet is a target subprocess, the detection client may send an activation process detection instruction to the detected client through the communication interface, acquire activation time of the target applet process, and may use time when the activation process detection instruction detects that the target applet process is activated as the activation time, where the detected client is a client running the target applet process.
Further, if the application of the target sub-process includes a log capture tool, a preset key event may be monitored through the log capture tool, and the time when the preset key event is monitored is determined as the activation time.
The preset monitoring event may be, but is not limited to, an application preloading event, a target subprocess creation, a target subprocess initialization, and the like.
Furthermore, the detection client may periodically detect whether the target subprogram is activated or not in a first preset period, where the first preset period may affect the accuracy of the detection activation time, for example, when the first preset period is 1 second, it indicates that the accuracy of the detection activation time is 1 second, theoretically, the smaller the first preset period is, the better the detection activation time is, but when the first preset period is too small, the operation of detecting whether the target subprogram is activated or not is too frequent, and other performances of the detection client are affected, so that a person skilled in the art may set the first preset period according to actual requirements.
As an embodiment, when the target applet is the target main process, the detection client may obtain a start time of the target applet, and use the obtained start time as the activation time, where the start time may be a time recorded by a user for opening the target applet.
Step S402, acquiring a reference memory of the target applet process at the activation time.
As an embodiment, when the target applet is a target subprocess, the detection client may send a memory obtaining instruction to the detected client at the activation time, and obtain a memory of the target applet process as a reference memory.
As an embodiment, when the target applet is the target main process, the detection client periodically collects the memory of the target main process after determining that the target main process is activated, and uses the collected memory of the target main process at the activation time as a reference memory.
Step S403, acquiring a process memory in the process of running the target applet.
And in the process of running the target small program, sending a plurality of memory acquisition instructions to the detected client through the communication interface, and acquiring a plurality of process memories of the target small program at different times by the plurality of memory acquisition instructions.
The detection client may periodically send the memory obtaining instruction to the detected client in a second setting period to obtain the process memory of the target applet process, the second setting period is not limited too much, and a person skilled in the art may set the second setting period according to actual requirements, for example, the second setting period is set to 1 second, 0.5 second, and the like.
As an embodiment, when the target applet is a target subprocess, a memory acquisition instruction acquires a plurality of memories of the target subprocess, and the acquired memory is used as a process memory in the running of the target subprocess.
As an embodiment, when the target applet is a target main process, a memory in a process of running the target applet by the target main process is used as a process memory, wherein the detection client can obtain the closing time of the target applet, and the memory of the target main process is used as the process memory within the starting time and the closing time of the target applet.
Step S404, determining a reference memory of the target applet according to the acquired process memory and the reference memory.
And determining the difference value between the process memory and the reference memory as the increment memory of the target small program.
If a plurality of process memories of the target applet at different times are obtained in step S403, a difference between each process memory and the reference memory is determined, and the obtained differences are used as a plurality of incremental memories of the target applet at different times.
To facilitate understanding of the present application, several examples of incremental memory determination of applets are given below.
Example 1: the target applet process is a target subprocess
Here, a mobile phone is used as a detected client, an Android Debug Bridge (ADB) tool is used as a detected client, a mini-game in a first instant messaging application is used as a target mini-program for explanation, the mini-game in the first instant messaging application runs in a sub-process of the first instant messaging application, a user starts the mini-game and then runs the mini-game in the corresponding sub-process, and the sub-process in which the mini-game runs is the target sub-process.
Referring to fig. 5, after the first instant messaging application is started, and after the user starts the mini-game in the first instant messaging application, the detection client collects the memory of the target sub-process when the mini-game is started as a reference memory, wherein when the user starts the mini-game, the target sub-process for running the mini-game is created in the first instant messaging application; and in the process of experiencing the mini-game by the user, the detection client continuously acquires the memory of the target sub-process as the process memory, and after the user closes the mini-game, the detection client calculates the incremental memory of the mini-game according to the reference memory and the process memory.
The method for calculating the incremental memory of the mini-game in the first instant messaging application is described in detail below.
The target sub-process running the mini-game in this example is named com.
When a user opens a mini-game in a first instant messaging application, the following steps are sequentially carried out: the first instant communication application pulls up the target subprocess, loads the basic library in the target subprocess, downloads the resource package and the code package of the mini game, executes the code in the target subprocess and renders the picture of the mini game, wherein each step continuously changes the memory of the target subprocess due to the loading of different resources, and the resource package can comprise animation or picture of the mini game and the like.
Sending the dumpsys activity to the mobile phone through a communication interface, acquiring application information of all applications such as application packet names running on an android system of the mobile phone, and storing the acquired application information into an application information list and the like; and screening the application currently positioned in the foreground from the application information list through an activation process detection instruction such as grepp, wherein the application positioned in the foreground is the activated application.
When different applications are located in the foreground, the result of the reduced activity grepp is different, for example, when the first instant messaging application is located in the foreground, the execution result of the reduced activity grepp is Proc #0: for T/a/T trm: 05257: com. When the target mini-game of the first instant messaging application is located at the foreground, the target mini-game is activated, and the execution result is Proc #2: form T/A/T trm: 013836: com.
According to the execution result of the instruction, the regular expression is used for judging whether the execution result contains a character string in the form of com. In order to monitor when the target sub-process is switched to the foreground, the instruction of the dumpsys activity gradient top needs to be executed circularly, and character string matching is carried out according to the result of the instruction. Through a large number of experiments, when an ADB tool is used as a detection client, the first set period can be set to be 0.3 second, and the acquisition precision is improved as much as possible on the premise that stable and available ADB service is guaranteed.
When the target subprocess is detected to be positioned in the foreground, the memory of the target subprocess can be obtained through a memory obtaining instruction dumpsys meminfo-pid, wherein the 'pid' is a process identifier of the target subprocess.
As shown in fig. 6, a schematic diagram of the process of the ADB tool determining the incremental memory of the mini-game of the first instant messaging application is given:
after the ADB tool starts monitoring, the active process detection instruction dumpsys activity gradient top is periodically executed in a first set period, and whether the process of the foreground is the target subroutine is determined according to the execution result of the active process detection instruction.
And determining the time when the process of the detection foreground is the target subprocess as the activation time, sending a memory acquisition instruction dump sys meminfo-pid to the detected client at the activation time, and acquiring the memory of the target subprocess as the reference memory.
And further continuing to periodically execute the dumpsys activity gradient top in a first set period to judge whether the target subprocess finishes running or not, if the dumpsys activity gradient top detects that the process of the foreground is not the target subprogram, determining that the target subprocess finishes running, and periodically sending a memory acquisition instruction dumpsys meminfo-pid to the detected client in a second set period to acquire a plurality of memories of the target subprocess as a plurality of process memories.
And if the target sub-process is determined not to be in the foreground, calculating the incremental memory of the mini-game according to the process memories and the reference memory, and finishing the test after calculating the incremental memory.
Example 2: the target applet process is a target subprocess
In this example, the time when the preset key event is monitored is taken as the activation time of the target applet process, and the mobile phone is taken as the detected client, the ADB tool is taken as the detected client, and the mini-game in the second instant messaging application is taken as the target applet for explanation.
Referring to fig. 7, the mini game in the second instant messaging application also runs in the sub-process, after the second instant messaging application is started, when the user starts the mini game, the main process of the second instant messaging application and the target sub-process of the loaded mini game respectively output logcat logs, the time of monitoring the logcat logs of the preset key events is the activation time, and the memory of the target sub-process is collected at the activation time as the reference memory; and in the process of experiencing the mini-game by the user, the detection client continuously acquires the memory of the target sub-process as the process memory, and after the user closes the mini-game, the detection client calculates the incremental memory of the mini-game according to the reference memory and the process memory.
The method for calculating the incremental memory of the mini-game in the second instant messaging application will be described in detail below.
The name of a target sub-process for running the mini-game in the second instant messaging application is "com.
The mini-game in the second instant messaging application has a preloading mechanism, and before the mini-game is not opened, the main process of the second instant messaging application can create an idle mini sub-process, load a basic library, a game engine of the mini-game and the like. When a user opens the mini-game in the second instant messaging application, the main process of the second instant messaging application searches for an idle mini sub-process to load and run the mini-game. The mini sub-process is a target sub-process after the mini game is loaded, and the target sub-process outputs a logcat log in a log capture tool logcat log system when being started and loaded, so that the loading of a corresponding event is completed; for example, when the target sub-process starts preloading, the logcat log system outputs do _ preload, which indicates that the target sub-process starts loading, and when the target sub-process finishes loading, the logcat log outputs minipp-start.
The main process of the second instant messaging application selects the time for running the target sub-process of the mini-game as the activation time, the object idle processor from stack _ pid information is output in the log at the activation time, the process number pid of the target sub-process can be analyzed from the information, and at the moment, the memory of the target sub-process with the process number pid is acquired through the memory and is used as a reference memory.
Reading logcat logs of a main process and a mini sub-process of the second instant messaging application from a logcat log system, screening results from the logcat logs, performing character string matching, and determining the detection wet tissue of the target sub-process of the mini game when the target character strings are matched; the start of loading may be determined from the time minipp-start is detected in the host process's logcat log system; when the onCreate key is detected from the logcat log of the target child process, it may be confirmed that the target child process has completed loading.
As shown in fig. 8, a schematic diagram of the process of the ADB tool determining the incremental memory of the mini-game of the second instant messaging application is given:
after the ADB tool starts monitoring, periodically executing the ADB log | findstr miniapp in a first set period to monitor the log of the log output by the main process and the target sub-process of the second instant messaging application, and determining whether the log of the second instant messaging application contains a preset key event.
Determining the time for detecting the preset key event as activation time, extracting the process number pid of the target sub-process from the logcat log at the activation time, sending a memory acquisition instruction dumpsys meminfo-pid to the detected client, and acquiring the memory of the target sub-process as a reference memory.
And further continuing to periodically execute the dumpsys activity | grep to judge whether the target subprocess finishes running or not in the first set period, and periodically sending a memory obtaining instruction dumpsys meminfo-pid to the detected client in the second set period if the target subprocess finishes running, so as to obtain a plurality of memories of the target subprocess as a plurality of process memories.
And if the target sub-process is determined not to be in the foreground, calculating the incremental memory of the mini-game according to the process memories and the reference memory, and finishing the test after calculating the incremental memory.
Example 3: the target small program process is a target main process
Here, a description will be given with a mobile phone as a detected client, an ADB tool as a detected client, and a mini-game in a certain handheld game application as a target mini-program.
A certain palm game application is an assistant APP of a certain game application, and a player can check the latest game information and video in the APP, and can also post and upload the video for communication and playing. Providing a part of small games in the APP and linking with an end play method; the game player in the mini-game can perform fresh tasting experience on new hero and theme activities in a certain game application, and the game player can perform experience by opening the mini-game in the APP through Webview.
Referring to fig. 9, because there is no independent sub-process or logcat log system in a certain handheld game application, a mini game can only run in a main process of a certain handheld game application, and at this time, the main process of a certain handheld game application is a reference memory of the mini game in a certain handheld game application of the target main process, and the reference memory of the main process before the mini game is pulled up is used as a reference; and in the process that the user experiences the mini-game, the memory of the target main process is used as a process memory, and after the user closes the mini-game, the detection client calculates the incremental memory of the mini-game according to the reference memory and the process memory.
As shown in fig. 10, a schematic diagram of the process of the ADB tool determining the incremental memory of a mini-game of a certain handheld game application is given:
after the ADB tool starts monitoring, the activation progress detection instruction dumpsys activity | grep is periodically executed in a first set period, and whether a target main progress of a certain handheld game application is located in the foreground or not is determined, that is, whether the target main progress is activated or not is determined.
And after the target main process is determined to be activated, periodically sending a memory obtaining instruction dump sys meminfo-pid to the detected client in a second set period, and obtaining a plurality of memories of the target sub-process as a plurality of process memories.
When a user experiences a mini-game, the starting time of the mini-game and the closing time of the mini-game can be recorded, the starting time of the mini-game is used as the activating time of the mini-game, and the activating time and the closing time are input into the detection client.
After the detection client acquires the activation time and the closing time, determining the memory of the target main process in the activation time as a reference memory, taking a plurality of memories of the target main process between the activation time and the closing time as a plurality of process memories, calculating the incremental memory of the mini game according to the plurality of process memories and the reference memory, and ending the test after calculating the incremental memory.
To facilitate understanding of the implementation effect of the present application, the present application further provides a schematic diagram of an incremental memory of an applet, and specifically refer to fig. 11, where a horizontal axis represents a time point of acquiring a process memory of a target applet process, and a unit of the time point is second; the vertical axis represents the memory size of the process memory, the base memory, and the delta memory, in units of "MB".
In the method, the memory when the target applet is activated is used as a reference memory, the difference value between the process memory and the reference memory is used as an incremental memory, and the memory overhead when the target applet operates is evaluated by the incremental memory, so that the memory overhead of loading a basic library and the memory overhead of Webview are eliminated, the memory overhead occupied by the applet during operation is more accurately reflected, and a technician can more accurately evaluate the performance of the applet and the client to be detected.
Referring to fig. 12, an incremental memory determination apparatus 1200 for an applet, which corresponds to the detection client 120 discussed above, includes:
an activation time determining unit 1201, configured to obtain activation time of a target applet process, where the target applet process is a process for loading a target applet;
a reference memory obtaining unit 1202, configured to obtain a reference memory of the target applet process at the activation time by a user;
a process memory obtaining unit 1203, configured to obtain a process memory in the process of running the target applet; and
an incremental memory determining unit 1204, configured to determine that a difference between the process memory and the reference memory is an incremental memory of the target applet, where the incremental memory represents a memory overhead occupied by the target applet when the target applet operates.
As an embodiment, the process memory obtaining unit is specifically configured to send, through a communication interface, a plurality of memory obtaining instructions to a client that runs the target applet process in a running process of the target applet process, and obtain, by the plurality of memory obtaining instructions, a plurality of process memories of the target applet process at different times; and
the incremental memory determining unit is specifically configured to determine a difference between each process memory and the reference memory, and obtain a plurality of incremental memories of the target applet at different times.
As an embodiment, the target applet process is a target subprocess for loading the target applet;
the reference memory of the target small program process at the activation time is the memory of the target sub-process at the activation time;
and the process memory in the running process of the target small program process is the memory in the running process of the target sub-process.
As an embodiment, the activation time determining unit is configured to send an activation process detection instruction to a client running the target applet process through the communication interface, and obtain the activation time of the target applet process.
As an embodiment, the activation time determining unit is configured to:
monitoring a preset key event through a log capture tool;
and determining the time for monitoring the preset key event as the activation time of the target small program process.
As an embodiment, the target applet process is a target main process for loading the target applet;
the reference memory of the target small program process at the activation time is the memory of the target main process at the activation time;
and the process memory in the process of running the target small program is the memory in the process of running the target small program for the target main process.
As an embodiment, the activation time determining unit is configured to:
acquiring the starting time of the target applet;
and determining the starting time as the activation time of the target applet process.
As an example, the apparatus in fig. 12 may be used to implement any of the small program incremental memory determination methods discussed above.
Based on the same inventive concept, an embodiment of the present application provides an incremental memory determination apparatus for an applet, which is equivalent to the detected client 110 discussed above, please refer to fig. 13, the apparatus 1300 includes a transceiver module 1301 and a processing module 1302, where:
the transceiver module 1301 is configured to receive and execute various operation instructions sent by the detection client under the control of the processing module 1302, and send execution results of the various operation instructions to the detection client through the communication interface.
As an example, the apparatus of FIG. 13 may be used to implement the applet incremental memory determination method discussed above.
Referring to fig. 14, the terminal device 100 provided in this embodiment includes a display unit 1440, a processor 1480, and a memory 1420, where the display unit 1440 includes a display panel 1441 for displaying information input by a user or information provided to the user, and various operation interfaces of the detection client 120 and the detected client 110, and in this embodiment, the display unit is mainly used for displaying an interface of a client installed in the terminal device 100, a shortcut window, and the like.
Alternatively, the Display panel 1441 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The processor 1480 is used to read the computer program and then execute a method defined by the computer program, for example, the processor 1480 reads a detection application or a detected application, etc., so as to run the application on the terminal device 100 and display an interface of the application on the display unit 1440. The Processor 1480 may include one or more general purpose processors and may further include one or more DSPs (Digital Signal processors) for performing relevant operations to implement the solutions provided by the embodiments of the present application.
Memory 1420 generally includes both internal and external memory, which may be Random Access Memory (RAM), Read Only Memory (ROM), and CACHE (CACHE). The external memory can be a hard disk, an optical disk, a USB disk, a floppy disk or a tape drive. The memory 1420 is used for storing computer programs including application programs and the like corresponding to the clients, and other data, which may include data generated after the operating system or the application programs are executed, including system data (e.g., configuration parameters of the operating system) and user data. In the embodiment of the present application, the program instructions are stored in the memory 1420, and the processor 1480 executes the program instructions stored in the memory 1420 to implement any one of the methods for determining incremental memory for applets discussed in the previous figures.
In addition, the terminal device 100 may further include a display unit 1440 for receiving input digital information, character information, or contact touch operation/non-contact gesture, and generating signal input related to user setting and function control of the terminal device 100, and the like. Specifically, in this embodiment, the display unit 1440 may include a display panel 1441. The display panel 1441, such as a touch screen, can collect touch operations of a user (such as operations of the user on the display panel 1441 or on the display panel 1441 by using any suitable object or accessory, such as a finger, a stylus, etc.) on or near the display panel 1441, and drive corresponding connection devices according to a preset program. Alternatively, the display panel 1441 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a player, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device and converts it to touch point coordinates, which are provided to the processor 1480 and can receive and execute commands from the processor 1480. In this embodiment, if the user clicks the detected client 110, and a touch detection device in the display panel 1441 detects a touch operation, the touch controller sends a signal corresponding to the detected touch operation, converts the signal into a touch point coordinate, and sends the touch point coordinate to the processor 1480, and the processor 1480 determines that the user needs to detect the detected client 110 according to the received touch point coordinate.
The display panel 1441 may be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The terminal apparatus 100 may further include an input unit 1430, in addition to the display unit 1440, and the input unit 1430 may include, but is not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
In addition to the above, the terminal device 100 may further include a power supply 1490 for supplying power to other modules, an audio circuit 1460, a near field communication module 1470, and an RF circuit 1410. The terminal device 100 may also include one or more sensors 1450, such as acceleration sensors, light sensors, pressure sensors, and the like. The audio circuit 1460 specifically includes a speaker 1461, a microphone 1462, and the like, and for example, the terminal device 100 may collect a user's voice through the microphone 1462, perform corresponding operations, and the like.
For one embodiment, the number of the processors 1480 may be one or more, and the processors 1480 and the memories 1420 may be coupled or relatively independent.
As an embodiment, the processor 1480 in fig. 14 may be configured to implement the functions of the activation time determining unit 1201, the reference memory obtaining unit 1202, the process memory obtaining unit 1203, and the incremental memory determining unit 1204 in fig. 12.
The processor 1480 of fig. 14 may be used to implement the functions of the processing module 1301 and the transceiver module 1302 of fig. 13 as an example.
As an example, the processor 1480 of fig. 14 may be used to implement the functionality of the detection client 120, and/or the functionality of the detection client 110 discussed above.
Based on the same technical concept, the embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions that, when executed on a computer, cause the computer to execute the incremental memory determination method of the applet as discussed above.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method for determining an increment memory of an applet is applied to a detection client, and comprises the following steps:
acquiring the activation time of a target small program process, wherein the target small program process is a process for loading a target small program;
acquiring a reference memory of the target applet process at the activation time; the reference memory is the memory overhead of the target small program process when the small program container finishes basic library loading but does not download the code packet of the target small program;
acquiring a process memory in the process of running the target applet; and
and determining the difference value between the process memory and the reference memory as an increment memory of the target small program, wherein the increment memory represents memory overhead occupied by the target small program during operation.
2. The method of claim 1, wherein the obtaining the process memory in the running process of the target applet specifically comprises:
in the running process of the target small program process, sending a plurality of memory acquisition instructions to a client running the target small program process through a communication interface, and acquiring a plurality of process memories of the target small program process at different times by the plurality of memory acquisition instructions; and
the determining that the difference value between the process memory and the reference memory is the incremental memory of the target applet specifically includes:
and respectively determining the difference value between each process memory and the reference memory to obtain a plurality of incremental memories of the target applet at different times.
3. A method according to claim 1 or 2, wherein the target applet process is a target sub-process for loading the target applet;
the reference memory of the target small program process at the activation time is the reference memory of the target sub-process at the activation time;
and the process memory in the running process of the target small program process is the memory of the target sub-process in the running process.
4. The method of claim 3, wherein the obtaining the activation time of the target applet process comprises:
and sending an activation process detection instruction to a client running the target applet process through a communication interface to acquire the activation time of the target applet process.
5. The method of claim 3, wherein the obtaining the activation time of the target applet process comprises:
monitoring a preset key event through a log capture tool;
and determining the time when the preset key event is monitored as the activation time of the target small program process.
6. A method according to claim 1 or 2, wherein the target applet process is a target host process which loads the target applet;
the reference memory of the target small program process at the activation time is the reference memory of the target main process at the activation time;
and the process memory in the process of running the target small program is the memory in the process of running the target small program for the target main process.
7. The method of claim 3, wherein the obtaining the activation time of the target applet process comprises:
acquiring the starting time of the target applet;
determining the starting time as the activation time of the target applet process.
8. An apparatus for determining incremental memory of an applet, the apparatus comprising:
the activation time determining unit is used for acquiring the activation time of a target small program process, wherein the target small program process is a process for loading a target small program;
a reference memory obtaining unit, which is used for obtaining a reference memory of the target small program process at the activation time by a user; the reference memory is the memory overhead of the target small program process when the small program container finishes basic library loading but does not download the code packet of the target small program;
a process memory obtaining unit, configured to obtain a process memory in the process of running the target applet; and
and the incremental memory determining unit is used for determining that the difference value between the process memory and the reference memory is the incremental memory of the target applet, and the incremental memory represents the memory overhead occupied by the target applet during operation.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1-7 are implemented when the program is executed by the processor.
10. A computer-readable storage medium having stored thereon computer instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-7.
CN201911155560.3A 2019-11-22 2019-11-22 Incremental memory determining method, device and equipment of small program and storage medium Active CN110888740B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911155560.3A CN110888740B (en) 2019-11-22 2019-11-22 Incremental memory determining method, device and equipment of small program and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911155560.3A CN110888740B (en) 2019-11-22 2019-11-22 Incremental memory determining method, device and equipment of small program and storage medium

Publications (2)

Publication Number Publication Date
CN110888740A CN110888740A (en) 2020-03-17
CN110888740B true CN110888740B (en) 2022-06-03

Family

ID=69748457

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911155560.3A Active CN110888740B (en) 2019-11-22 2019-11-22 Incremental memory determining method, device and equipment of small program and storage medium

Country Status (1)

Country Link
CN (1) CN110888740B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113391854A (en) * 2021-06-16 2021-09-14 湖南快乐阳光互动娱乐传媒有限公司 Communication method and device for host application program and applet
CN113791988B (en) * 2021-11-17 2022-02-18 畅捷通信息技术股份有限公司 Rendering method and device for reducing volume of small program package and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006016407A1 (en) * 2004-08-12 2006-02-16 Fujitsu Limited Java applet, jar file creating method, jar file creating program, and jar file creating device
CN105893267A (en) * 2015-10-14 2016-08-24 乐视致新电子科技(天津)有限公司 Memory space clearing method and device
CN108132841A (en) * 2017-12-11 2018-06-08 杭州迪普科技股份有限公司 A kind of memory allocation method and device of the equipment based on linux system
CN109726076A (en) * 2018-12-03 2019-05-07 百度在线网络技术(北京)有限公司 A kind of small routine life cycle management method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006016407A1 (en) * 2004-08-12 2006-02-16 Fujitsu Limited Java applet, jar file creating method, jar file creating program, and jar file creating device
CN105893267A (en) * 2015-10-14 2016-08-24 乐视致新电子科技(天津)有限公司 Memory space clearing method and device
CN108132841A (en) * 2017-12-11 2018-06-08 杭州迪普科技股份有限公司 A kind of memory allocation method and device of the equipment based on linux system
CN109726076A (en) * 2018-12-03 2019-05-07 百度在线网络技术(北京)有限公司 A kind of small routine life cycle management method and system

Also Published As

Publication number Publication date
CN110888740A (en) 2020-03-17

Similar Documents

Publication Publication Date Title
US9811313B2 (en) Voice-triggered macros
Halpern et al. Mosaic: cross-platform user-interaction record and replay for the fragmented android ecosystem
US8448094B2 (en) Mapping a natural input device to a legacy system
CN108363528B (en) Application page starting method and device, storage medium and electronic equipment
CN110362483B (en) Performance data acquisition method, device, equipment and storage medium
US9575864B2 (en) Function-level dynamic instrumentation
CN109074278B (en) Validating stateful dynamic links in mobile applications
US7707400B2 (en) Direct computing experience
CN110941551B (en) Application stuck detection method, device and equipment and computer storage medium
US7516317B2 (en) Measuring an operating system's boot duration
US8847880B2 (en) Method and apparatus for providing motion library
CN103761044A (en) Touch event model programming interface
CN110888740B (en) Incremental memory determining method, device and equipment of small program and storage medium
US20160077831A1 (en) Accurate and performant code design using memoization
US8320838B2 (en) Host-mobile trace synchronization and comparison
CN112559069B (en) Running control method and device of sub-application, storage medium and electronic equipment
CN107025173B (en) Method and device for testing function execution time
CN110888781B (en) Application blockage detection method and detection device
CN107861827B (en) Card screen detection method, mobile terminal and computer readable storage medium
CN112988304B (en) Recording method and device of operation mode, electronic equipment and storage medium
CN110417931B (en) Domain name resolution record acquisition method and device, computer equipment and storage medium
Park et al. Gesto: Mapping UI events to gestures and voice commands
CN114443453A (en) Test data recording method, device, equipment and computer storage medium
CN112052454A (en) Method, device and equipment for searching and killing applied viruses and computer storage medium
KR101896459B1 (en) Method and mobile game ystem for distinguishing between real mobile device and virtual machine using sensor information

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40022632

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant