CN113961534A - Method and electronic equipment for generating log file - Google Patents

Method and electronic equipment for generating log file Download PDF

Info

Publication number
CN113961534A
CN113961534A CN202111569918.4A CN202111569918A CN113961534A CN 113961534 A CN113961534 A CN 113961534A CN 202111569918 A CN202111569918 A CN 202111569918A CN 113961534 A CN113961534 A CN 113961534A
Authority
CN
China
Prior art keywords
record
log file
generating
system time
picture
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
CN202111569918.4A
Other languages
Chinese (zh)
Other versions
CN113961534B (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.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202111569918.4A priority Critical patent/CN113961534B/en
Publication of CN113961534A publication Critical patent/CN113961534A/en
Application granted granted Critical
Publication of CN113961534B publication Critical patent/CN113961534B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a method for generating a log file and electronic equipment, wherein the method is executed by the electronic equipment and comprises the following steps: when a test tool in the electronic equipment is in a running state, if a first operation input by a user is received, generating a first log file corresponding to the first operation, wherein each record in the first log file records the system time when the record is generated; generating a first video according to a page displayed by the electronic equipment after receiving a first operation, and acquiring system time corresponding to each frame of picture in the first video when the first video is generated; and writing a first picture in the first video into a first record in a first log file to generate a second log file, wherein the system time corresponding to the first picture is the same as the system time when the first record is generated, and the first record is any record in the first log file. The method can improve the efficiency of the whole test process and the accuracy of the test result.

Description

Method and electronic equipment for generating log file
Technical Field
The present application relates to the field of electronic technologies, and in particular, to a method for generating a log file and an electronic device.
Background
At present, in the development process of electronic equipment such as a mobile phone and the like, functional problems or performance problems need to be tested so as to improve the use stability of the electronic equipment. The analysis and solution of the function or performance problems mainly depend on information output by a performance tracking log (sysstrace), and the reason of the problems can be determined by analyzing the sysstrace log so as to find a method for solving the problems.
Generally, when testing an electronic device, a user may record an operation video during the test, so as to know the content of a page displayed on the electronic device during the current test. Then, when the sysstrace log is analyzed subsequently, the page content corresponding to the sysstrace log can be acquired to determine which operation page has a problem.
In the related art, most of the operation videos are manually recorded for several frames to determine the page content corresponding to the problem part in the sysstrace log. Therefore, the process of manually counting frames in the related art is inefficient, and the accuracy of the result is low.
Disclosure of Invention
The application provides a method for generating a log file and electronic equipment, which can improve the efficiency of the whole test process and the accuracy of a test result.
In a first aspect, the present application provides a method for generating a log file, where the method is performed by an electronic device, and includes: when a test tool in the electronic equipment is in a running state, if a first operation input by a user is received, generating a first log file corresponding to the first operation, wherein each record in the first log file records the system time when the record is generated; generating a first video according to a page displayed by the electronic equipment after receiving a first operation, and acquiring system time corresponding to each frame of picture in the first video when the first video is generated; and writing a first picture in the first video into a first record in a first log file to generate a second log file, wherein the system time corresponding to the first picture is the same as the system time when the first record is generated, and the first record is any record in the first log file.
In this implementation, the test tool may be an Application Package (APK), which may call the sysstrace tool to generate a test log. The first operation may be any operation input by the user, that is, all operations performed on the electronic device by the user after the test is started are recorded and a test log is generated, so as to generate a first log file (e.g., a temporary log file), where the first log file may be a hypertext markup language (HTML) file. The first log file may include a plurality of records, and each record may further include a target keyword, for example, the target keyword tracking _ mark _ write is used to indicate that screen drawing is currently performed, that is, a current user has an operation on the electronic device. Here, in order to associate the first log file with a picture in the first video described below, each record in the first log file corresponds to the system time at which the record was generated.
Meanwhile, the electronic device can display different display contents after receiving the first operation, so that the displayed contents can also be generated into a first video (such as an operation video), and each frame of picture in the first video corresponds to the system time when the frame of picture is generated.
Then, the electronic device may compare the system time when the record is generated with the system time when the picture in the first video is generated, and write the first picture into the first record with the same system time as the first picture, so as to generate a second log file, that is, a final log file (for example, a file in jpg. Therefore, the user can directly check the picture corresponding to each log record through the obtained log file, namely the page content corresponding to the log during the test, so that the efficiency of the whole test process is improved, and the accuracy of the result is also improved by carrying out the correspondence through the system time.
With reference to the first aspect, in some implementations of the first aspect, the method further includes: acquiring system time when a first record in a first log file is generated; and for the ith record in the first log file, determining the system time when the ith record is generated according to the system time when the first record is generated, the kernel time when the first record is generated and the kernel time when the ith record is generated, wherein i is more than or equal to 2 and less than or equal to n, and n is the number of records in the first log file.
In one implementation, for determining the system time when each record in the first log file is generated, the electronic device may obtain the system time when the first record is generated. And because the kernel time when each record is generated is obtained when the sysstrace tool generates the test log, the electronic device can determine the system time when the ith record is generated according to the kernel time when the ith record is generated, the kernel time when the first record is generated and the system time. In another implementation, the electronic device may also obtain the current system time when each record is generated. Therefore, the electronic device can determine the system time of each record in the first log file so as to compare with the system time of each frame of picture in the subsequent first video.
With reference to the first aspect, in some implementation manners of the first aspect, the determining, according to the system time when the first record is generated, the kernel time when the first record is generated, and the kernel time when the ith record is generated, the system time when the ith record is generated includes: calculating the time difference between the kernel time when the ith record is generated and the kernel time when the first record is generated; and determining the system time when the ith record is generated according to the summation relation between the system time when the first record is generated and the time difference.
If the system time when the first record is generated is recorded as B1, the kernel time when the first record is generated is recorded as a1, and the kernel time when the ith record is generated is recorded as a2, the electronic device may calculate the time difference between a2 and a1, and then sum B1 with the time difference, so as to obtain the system time when the ith record is generated. That is, the system time at which the ith record is generated may be determined from the relationship containing A2-A1+ B1.
In the implementation mode, the electronic device can quickly obtain the system time corresponding to the ith record by calculating the time difference between the kernel time corresponding to the ith record and the kernel time corresponding to the first record and the system time, so that the calculation efficiency is improved.
With reference to the first aspect, in some implementations of the first aspect, after generating the first video, the method further includes: superposing and displaying the system time corresponding to the jth frame picture in the first video on the jth frame picture, and storing the jth frame picture, wherein j is more than or equal to 1 and is less than or equal to m, and m is the frame number of the picture included in the first video; the writing a first picture in a first video into a first record in a first log file to generate a second log file includes: acquiring a storage address of a first picture; and writing the storage address of the first picture into the first record to generate a second log file.
In this implementation manner, the electronic device may display the system time corresponding to the jth frame of picture on the picture in an overlapping manner, and store the system time, so that the user can conveniently view the system time. When a second log file is generated subsequently, the storage address of the first picture can be written into the first record, and the picture and the log are quickly fused to generate the second log file.
With reference to the first aspect, in some implementations of the first aspect, the method further includes: receiving a second operation input by the user; in response to the second operation, the test tool is run.
The electronic device may further provide an interface for a user to start a test tool, and when the user starts to operate the test tool, the process of the implementation manner is executed, and when the user closes to operate the test tool, the process of the implementation manner is not executed. Thereby satisfying different needs of users.
With reference to the first aspect, in some implementation manners of the first aspect, the generating a first log file corresponding to the first operation includes: and generating a first log file corresponding to the first operation through the testing tool.
With reference to the first aspect, in some implementation manners of the first aspect, the generating a first video according to a page displayed by the electronic device after receiving the first operation includes: and generating a first video according to the page displayed by the electronic equipment after receiving the first operation through the testing tool.
With reference to the first aspect, in some implementation manners of the first aspect, the writing a first picture in a first video into a first record in a first log file to generate a second log file includes: and writing the first picture into the first record through the testing tool to generate a second log file.
In the implementation mode, each step of process can be realized by the test tool without participation of other modules in the electronic equipment, so that the use power consumption of the electronic equipment is reduced.
In a second aspect, the present application provides an apparatus, which is included in an electronic device, and which has a function of implementing the behavior of the electronic device in the first aspect and the possible implementation manners of the first aspect. The functions may be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described functions. Such as a receiving module or unit, a processing module or unit, etc.
In a third aspect, the present application provides an electronic device, comprising: a processor, a memory, and an interface; the processor, the memory and the interface cooperate with each other to enable the electronic device to perform any one of the methods of the first aspect.
In a fourth aspect, the present application provides a chip comprising a processor. The processor is adapted to read and execute the computer program stored in the memory to perform the method of the first aspect and any possible implementation thereof.
Optionally, the chip further comprises a memory, the memory being connected to the processor by a circuit or a wire.
Further optionally, the chip further comprises a communication interface.
In a fifth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute any one of the methods in the technical solutions of the first aspect.
In a sixth aspect, the present application provides a computer program product comprising: computer program code for causing an electronic device to perform any of the methods of the first aspect when the computer program code runs on the electronic device.
Drawings
Fig. 1 is a schematic structural diagram of an example of an electronic device according to an embodiment of the present disclosure;
FIG. 2 is a block diagram of a software architecture of an electronic device according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of an example of an interface for turning on a test application switch according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating an example of a method for generating a log file according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an example interface for initiating a test according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram illustrating an example of displaying a system time on a picture in an overlapping manner according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating an example of storing multiple frames of pictures in an operating video according to an embodiment of the present application;
FIG. 8 is a schematic diagram of an example of an interface for opening a generated log file according to an embodiment of the present disclosure;
fig. 9 is a flowchart illustrating another example of a method for generating a log file according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the embodiments herein, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more than two.
In the following, the terms "first", "second" and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", "third" may explicitly or implicitly include one or more of the features.
Currently, when an electronic device such as a mobile phone is tested, a sysstrace tool can be used to check and collect log information of all processes running on the device, which includes some data of an Android kernel (Android kernel), such as CPU scheduler data, input/output (I/O) data, application thread (APP thread) data, and the like, and an HTML file can be generated, which facilitates a user to view and analyze log contents.
In some scenarios, when a user uses the sysstrace tool to test the electronic device, in order to correspond the sysstrace log with the page content actually running on the electronic device, an operation video during the test is usually recorded. For example, when a user tests a wallet function of the electronic device or tests an APP installed in the electronic device, the screen recording function of the electronic device may be turned on, and an additional camera may be used to shoot a display screen of the electronic device to record an operation video during the test. Thus, after the test is finished, the sysstrace log and the corresponding operation video can be obtained; in the process of analyzing the sysstrace log, if a certain log is found to have an abnormality, the user can determine the time difference from the time when the test is started through the time recorded in the log, and then count frames from the operation video according to the time difference, for example, count frames at a frequency of two frames per 100 milliseconds (ms), so as to determine which frame of picture in the operation video corresponds to the time difference. Therefore, the user can find the operation performed when the problem occurs and the content of the page, and then analyze the script of the page to determine the cause of the problem. However, the method of counting frames manually has low process efficiency and low accuracy of results.
In other scenes, when a user uses the sysstrace tool to test the electronic device, only the sysstrace log is reserved, and when the abnormal log is found subsequently, the user cannot know how the actual page corresponding to the abnormal log is, so that the abnormal log needs to be reproduced. However, some abnormal problems have low probability and are difficult to reproduce sometimes.
In view of this, an embodiment of the present application provides a method for generating a log file, which corresponds a sysstrace log and an operation video by respectively adding system time of an electronic device to the sysstrace log and the recorded operation video, and further embeds each frame of picture of the operation video into a corresponding position in the sysstrace log to generate final log information. Therefore, the user can directly check the picture corresponding to each section of log through the obtained log information, namely the page content corresponding to the section of log during the test, so that the efficiency of the whole test process is improved, and the accuracy of the result is also improved by carrying out the correspondence through the system time. It should be noted that the method for generating a log file provided in the embodiment of the present application may be applied to an electronic device that can be tested, such as a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, a super-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), and the like, and the embodiment of the present application does not limit any specific type of the electronic device.
For example, fig. 1 is a schematic structural diagram of an example of an electronic device 100 provided in the embodiment of the present application. Taking the electronic device 100 as a mobile phone as an example, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, with N being a positive integer greater than 1.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
It is to be understood that the illustrated structure of the embodiment of the present application does not specifically limit the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Fig. 2 is a block diagram of a software structure of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, namely an application layer, a system layer, a kernel layer and a hardware layer from top to bottom.
As shown in fig. 2, the application layer may include a series of Application Packages (APKs), which may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, bluetooth, music, video, short message, etc., and may also include APKs for installed third party applications, such as test application APKs, sysstrace tools, etc.
The system layer may include an Android runtime (Android runtime), and the Android runtime includes a core library and a virtual machine, and is responsible for scheduling and managing the Android system, for example, the current system time may be acquired.
The kernel layer is a layer between hardware and software. The kernel layer may include a display driver to transmit picture data to be displayed to the display screen for display.
The hardware layer can include display card, display screen etc. and the data of the picture that the display screen is current showing can be stored to the display card, and the display screen is used for showing the picture, gives the visual experience of user.
For convenience of understanding, the following embodiments of the present application will specifically describe, by taking an electronic device having a structure shown in fig. 1 and fig. 2 as an example, a method for generating a log file provided by the embodiments of the present application in conjunction with the accompanying drawings and an application scenario.
In some scenarios, if a user wants to generate log information by using the method provided in the embodiment of the present application, a corresponding switch, for example, a "fusion switch" in fig. 3, may be turned on in a test application; if the user does not want to generate the log information by using the method provided in the embodiment of the present application, the "fusion switch" in fig. 3 may be closed, where the interface in fig. 3 may be displayed after the test application APK is run.
After the switch is turned on, in combination with the software structure shown in fig. 2, fig. 4 shows an interaction signaling diagram of each module in the electronic device for implementing the method for generating a log file according to the embodiment of the present application, as shown in fig. 4, the method includes:
s1, the test application APK receives the instruction for starting the test input by the user.
In which a portal for initiating a test, such as the "start test" button shown in fig. 5, may be provided in the test application APK. When the user clicks the button, the electronic device may perform the following process. Optionally, the user may also input the instruction for starting the test by voice, or input the instruction for starting the test by another shortcut key, or input the instruction for starting the test by a run command. It can be understood that, after the user inputs an instruction to start the test, the test application APK may run the sysstrace tool to obtain a test log when the user performs a test operation on the electronic device.
S2, in the process of testing the electronic device by the user, the test application APK calls the sysstrace tool to generate a test log, and acquires the system time when generating the log record containing the first target keyword.
And S3, after the test operation is completed, the test application APK generates an HTML file according to the test log.
S4, the test application APK analyzes the HTML file and extracts a plurality of target keywords, wherein the system time when the first target keyword is generated is recorded in the HTML file.
S5, determining the system time for generating the target keywords in the HTML file according to the system time corresponding to the first target keyword.
After the test is started, the user can perform a test operation on the electronic device, such as testing functions of some APPs in the electronic device, and all operations performed by the user on the electronic device can be recorded by the sysstrace tool and a test log is generated. For example, a user may test the function of a browser in an electronic device, and when a news item is clicked from a first page of the browser and a user jumps to a display page of the news item, the sysstrace tool may record a series of actions of clicking and jumping to display, and generate a corresponding test log. The test application APK may then retrieve the generated test log.
After the user starts the test, the test application APK will continuously obtain the test log, so that when the test operation is completed, all the test logs in the whole test process can be obtained. Thus, the test application APK can generate an HTML file from the entire test log.
A plurality of target keywords may be included in the HTML file, for example, the target keyword tracking _ mark _ write is used to indicate that screen drawing is currently performed, that is, the current user has an operation on the electronic device. In the information of the target keyword tracking _ mark _ write, the time for generating the keyword may be recorded by the keyword onMessageRefresh, and it should be noted that the time recorded by the sysstrace tool is the Kernel time (Kernel time) and is in milliseconds (ms). For example, 36118.675438: tracking _ mark _ write: b |1045| onMessageRefresh, the meaning of this log representation is: one screen draw was performed at a Kernel time of 36118.675438 ms.
However, since the Kernel time is recorded by the sysstrace tool, it is not the same as the system time of the electronic device, and the system time is also recorded in this step for the purpose of later corresponding to the system time of the operation video.
In one embodiment, assume that the test log 36118.675438 described above: tracking _ mark _ write: b |1045| is the first log about screen drawing generated after starting the test, the electronic device can: tracking _ mark _ write: b |1045| Time Line 16: 32: 21.455 adds system time 16 to the test log: 32: 21.455 (time, minutes, seconds), that is, the system time at that time needs to be obtained from the android runtime when the test log is generated in the step S2, and thus the obtained HTML may also include the system time corresponding to the first target keyword.
Then, the test application APK may extract all target keywords (training _ mark _ write and onMessageRefresh) from the HTML file, and generate the Kernel time of the target keywords, and determine the system time when generating other target keywords by the system time corresponding to the first target keyword and the time difference between the Kernel time of the first target keyword and the Kernel time of other target keywords.
Illustratively, assume that the log corresponding to the first target keyword is 36118.675438: tracking _ mark _ write: b |1045| Time Line 16: 32: 21.455, respectively;
one of the logs L corresponding to the other target keywords is 92978.474050: tracking _ mark _ write: b |1045| onMessageRefresh;
record 361188.675438 as a1, 92978.474050 as a2, 16: 32: 21.455 is recorded as B1, the system time B2= a2-a1+ B1=16 corresponding to the time when the log L is generated: 33: 18.315. by analogy, the system time when other targets are generated can be calculated.
In another embodiment, the electronic device may add, in addition to the corresponding system time in the first target keyword through the script, the corresponding system time in other target keywords through the same script, so as to obtain the system time when the plurality of target keywords are generated.
Illustratively, assume that the log corresponding to the first target keyword is 36118.675438: tracking _ mark _ write: b |1045| Time Line 16: 32: 21.455, respectively;
one of the logs L corresponding to the other target keywords is 92978.474050: tracking _ mark _ write: b |1045| Time Line 16: 33: 18.315, respectively;
then, the system time corresponding to the first target keyword is 16: 32: 21.455, the system time corresponding to the target keyword in the log L is 16: 33: 18.315, the logs corresponding to other target keywords are similar and will not be described herein.
Wherein, when executing the above-mentioned S2-S5, the electronic device also executes the following S6-S7:
and S6, in the process of testing the electronic equipment by the user, the test application APK acquires the data of the content displayed by the electronic equipment from the display card.
And S7, after the test operation is completed, the test application APK generates an operation video according to the data of the content displayed by the electronic equipment, wherein each frame of picture in the operation video comprises corresponding system time.
When the test application APK processes the test log, the data of the content displayed on the display screen of the electronic device may be obtained from the display card, or the data of the content displayed on the display screen may be obtained through an interface provided by the electronic device, for example, when a user tests a function of a browser in the electronic device, the test application APK may obtain the data of a browser home page and the data of a news display page when clicking a piece of news from the browser home page and jumping to the display page of the news. After the test operation is completed, the test application APK may acquire data of a plurality of continuous display contents, and generate an operation video according to the data, where the operation video is a video of contents displayed on the electronic device when the user tests the electronic device. It can also be understood that the test application APK performs a screen recording operation on the electronic device.
In the embodiment of the application, when the test application APK acquires the data of the content displayed by the electronic device, the current system time of the electronic device can also be acquired, and thus the acquired data of the displayed content corresponds to one system time each time. Therefore, each frame of picture in the operation video generated by the test application APK also contains the corresponding system time.
In one embodiment, the test application APK may embed the system time corresponding to each frame picture into the frame picture, for example, as shown in fig. 6, the system time (11: 34: 25.086) is written to the upper left corner of the frame picture.
In an embodiment, the test application APK may further cut the operation video into a plurality of frame pictures, then write the system time corresponding to each frame picture to the upper left corner of the frame picture, and store the plurality of frame pictures to the specified path. For example, the manner of storing a plurality of frame pictures may be as shown in fig. 7.
It can be understood that the system time added in the test log and the system time added in the frame picture of the operation video can be obtained through Android runtime.
Then, after obtaining the system time corresponding to the target keyword in the HTML file and the system time corresponding to each frame of picture in the operation video, the electronic device may execute the following processes:
and S8, matching the system time corresponding to the target keyword in the HTML file with the system time corresponding to each frame of picture in the operation video by the test application APK, and determining the target keyword and the frame of picture in the same system time.
And S9, the test application APK writes the frame picture into the target keyword in the HTML file at the same system time as the frame picture, and generates a final log file.
The target keywords in the HTML file correspond to the system time, and each frame of picture in the operation video also corresponds to the system time, so that the frame pictures with the same system time can be found in the operation video aiming at the target keywords in the HTML file; alternatively, for each frame of picture in the operation video, the target keyword of the same system time can be found in the HTML file. Then, the test application APK can write each frame of picture into the HTML file, where the writing position is the target keyword at the same system time as the frame of picture, and generate a log file in jpg.
In one embodiment, the test application APK may write the frame picture into the HTML file in the following manner: surfefringers-1042 (1042) (001.). 361189.521287: tracking _ mark _ write: B |1042| onMessageRefresh | src = F \ out \20211122_20_01_04_ XXX-XX \ frame _1. jpg.
Wherein F \ out \20211122_20_01_04_ XXX-XX \ frame _1.jpg is a saving path of the frame picture.
In an embodiment, after obtaining the log file in the jpg.html format, the user may click to open the log file, and the test application APK may deliver the content corresponding to the log file to the display driver to be displayed on the display screen. In another embodiment, the log file in the jpg. html format generated by the electronic device such as the mobile phone can also be transmitted to the electronic device such as the PC, so as to facilitate the user to view the log file. Illustratively, the display interface for opening the log file may be as shown in fig. 8; when a user clicks a certain position in the log distribution, a frame picture storage path corresponding to the position can be displayed below the page, so that the log and the page content corresponding to the log can be conveniently and visually checked.
According to the method for generating the log file, the electronic equipment respectively adds the system time of the electronic equipment in the sysstrace log and the recorded operation video to enable the sysstrace log to correspond to the operation video, and then each frame of picture of the operation video is embedded into the corresponding position in the sysstrace log to generate a final log file. Therefore, the user can directly check the picture corresponding to each section of log through the obtained log file, namely the page content corresponding to the section of log during the test, so that the efficiency of the whole test process is improved, and the accuracy of the result is also improved by carrying out the correspondence through the system time. Meanwhile, extra hardware such as a camera is not needed, and the testing cost is saved.
The above is a detailed process of the method for generating a log file provided in the embodiment of the present application, and the process is described below with an embodiment, and fig. 9 is a schematic flowchart of a method for generating a log file provided in another embodiment of the present application, and is applied to an electronic device, where the method includes:
s101, receiving a test starting operation input by a user, wherein the test starting operation is used for instructing the electronic equipment to operate a test tool.
The test starting operation input by the user may be an operation of the test starting instruction input in the above embodiment, and is used to instruct the electronic device to operate a test tool, such as a sysstrace tool.
S102, when the test tool is in the running state, when the test operation input by the user is received, generating a temporary log file corresponding to the test operation.
The test operation is any operation input by a user after the test tool is in the running state. That is, all operations performed by the user on the electronic device are recorded and the test log is generated, and then the temporary log file is generated, for example, the temporary log file is an HTML file.
It should be noted that at least one target keyword in the temporary log file corresponds to system time, for example, the first target keyword corresponds to system time when the keyword is generated.
And S103, determining the corresponding system time when each target keyword is generated in the temporary log file.
In this step, if the first target keyword corresponds to the system time when the keyword is generated, the electronic device may determine the system time when other target keywords are generated according to the system time corresponding to the first target keyword and a time difference between the Kernel times of the first target keyword and other target keywords.
And S104, acquiring data of a display page of the electronic equipment after the user inputs the test operation, and generating an operation video according to the data of the display page.
And S105, cutting the operation video into multiple frames of pictures, wherein each frame of picture comprises corresponding system time.
Wherein, the steps of S102-S103 and S104-S105 are performed simultaneously.
And S106, writing the frame picture in the operation video into a target keyword in the temporary log file at the same system time as the frame picture, and generating a final log file.
The electronic equipment can find the target keywords of the same system time in the temporary log file aiming at each frame of picture in the operation video. Then, the electronic device can write each frame of picture into a temporary log file, where the writing position is the target keyword of the same system time as the frame of picture, and generate a log file in a jpg.
Examples of the method for generating a log file provided by the embodiment of the present application are described above in detail. It will be appreciated that the electronic device, in order to implement the above-described functions, comprises corresponding hardware and/or software modules for performing the respective functions. Those of skill in the art would readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, with the embodiment described in connection with the particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional modules according to the method example, for example, the functional modules may be divided into the functional modules corresponding to the functions, such as the detection unit, the processing unit, the display unit, and the like, or two or more functions may be integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
It should be noted that all relevant contents of each step related to the above method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.
The electronic device provided by the embodiment is used for executing the method for generating the log file, so that the same effect as the effect of the implementation method can be achieved.
In case of an integrated unit, the electronic device may further comprise a processing module, a storage module and a communication module. The processing module can be used for controlling and managing the action of the electronic equipment. The memory module may be used to support the electronic device in executing stored program codes and data, etc. The communication module can be used for supporting the communication between the electronic equipment and other equipment.
The processing module may be a processor or a controller. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. A processor may also be a combination of computing functions, e.g., a combination of one or more microprocessors, a Digital Signal Processing (DSP) and a microprocessor, or the like. The storage module may be a memory. The communication module may specifically be a radio frequency circuit, a bluetooth chip, a Wi-Fi chip, or other devices that interact with other electronic devices.
In an embodiment, when the processing module is a processor and the storage module is a memory, the electronic device according to this embodiment may be a device having the structure shown in fig. 1.
The embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute the method for generating a log file according to any of the above embodiments.
The embodiment of the present application further provides a computer program product, which when running on a computer, causes the computer to execute the above related steps to implement the method for generating a log file in the above embodiment.
In addition, embodiments of the present application also provide an apparatus, which may be specifically a chip, a component or a module, and may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored in the memory, so that the chip can execute the method for generating the log file in the above-mentioned method embodiments.
The electronic device, the computer-readable storage medium, the computer program product, or the chip provided in this embodiment are all configured to execute the corresponding method provided above, so that the beneficial effects achieved by the electronic device, the computer-readable storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
Through the description of the above embodiments, those skilled in the art will understand that, for convenience and simplicity of description, only the division of the above functional modules is used as an example, and in practical applications, the above function distribution may be completed by different functional modules as needed, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. A method of generating a log file, the method performed by an electronic device, the method comprising:
when a test tool in the electronic equipment is in a running state, if a first operation input by a user is received, generating a first log file corresponding to the first operation, wherein each record in the first log file records the system time when the record is generated;
generating a first video according to a page displayed by the electronic equipment after receiving the first operation, and acquiring system time corresponding to each frame of picture in the first video when the first video is generated;
writing a first picture in the first video into a first record in the first log file to generate a second log file, wherein the system time corresponding to the first picture is the same as the system time when the first record is generated, and the first record is any record in the first log file.
2. The method of claim 1, further comprising:
acquiring system time when a first record in the first log file is generated;
and for the ith record in the first log file, determining the system time for generating the ith record according to the system time for generating the first record, the kernel time for generating the first record and the kernel time for generating the ith record, wherein i is more than or equal to 2 and less than or equal to n, and n is the number of records in the first log file.
3. The method of claim 2, wherein determining the system time for generating the ith record according to the system time for generating the first record, the kernel time for generating the first record, and the kernel time for generating the ith record comprises:
calculating the time difference between the kernel time when the ith record is generated and the kernel time when the first record is generated;
and determining the system time when the ith record is generated according to a summation relational expression between the system time when the first record is generated and the time difference.
4. The method of any of claims 1-3, wherein after generating the first video, the method further comprises:
superposing and displaying system time corresponding to a jth frame picture in the first video on the jth frame picture, and storing the jth frame picture, wherein j is more than or equal to 1 and is less than or equal to m, and m is the frame number of pictures included in the first video;
the writing a first picture in the first video into a first record in the first log file to generate a second log file includes:
acquiring a storage address of the first picture;
and writing the storage address of the first picture into the first record to generate the second log file.
5. The method of claim 1, further comprising:
receiving a second operation input by the user;
running the test tool in response to the second operation.
6. The method of claim 1, wherein the generating a first log file corresponding to the first operation comprises:
and generating a first log file corresponding to the first operation through the test tool.
7. The method of claim 1, wherein generating a first video according to the page displayed by the electronic device after receiving the first operation comprises:
and generating the first video according to the page displayed by the electronic equipment after the first operation is received through the testing tool.
8. The method of claim 1, wherein writing the first picture in the first video to the first record in the first log file, generating a second log file, comprises:
and writing the first picture into the first record through the test tool to generate the second log file.
9. An electronic device, comprising:
one or more processors;
one or more memories;
the memory stores one or more programs that, when executed by the processor, cause the electronic device to perform the method of any of claims 1-8.
10. A computer-readable storage medium, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the method of any one of claims 1 to 8.
11. A computer program product, the computer program product comprising: computer program code, characterized in that it, when run on an electronic device, causes the electronic device to perform the method of any of claims 1 to 8.
CN202111569918.4A 2021-12-21 2021-12-21 Method and electronic equipment for generating log file Active CN113961534B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111569918.4A CN113961534B (en) 2021-12-21 2021-12-21 Method and electronic equipment for generating log file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111569918.4A CN113961534B (en) 2021-12-21 2021-12-21 Method and electronic equipment for generating log file

Publications (2)

Publication Number Publication Date
CN113961534A true CN113961534A (en) 2022-01-21
CN113961534B CN113961534B (en) 2022-05-10

Family

ID=79473362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111569918.4A Active CN113961534B (en) 2021-12-21 2021-12-21 Method and electronic equipment for generating log file

Country Status (1)

Country Link
CN (1) CN113961534B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795727A (en) * 2023-08-25 2023-09-22 北京安天网络安全技术有限公司 Reproduction method and device of test process, electronic equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1975822A1 (en) * 2007-03-28 2008-10-01 Ricoh Company, Ltd. Method and apparatus for recording associations with logs
CN103092756A (en) * 2013-01-08 2013-05-08 彭勇 Interactive automated testing system and method thereof
US20130227350A1 (en) * 2012-02-23 2013-08-29 Cadence Design Systems, Inc. Recording and playback of trace and video log data for programs
CN106027307A (en) * 2016-05-30 2016-10-12 努比亚技术有限公司 Device and method for recording logs of modem
CN106557308A (en) * 2015-09-29 2017-04-05 腾讯科技(深圳)有限公司 A kind of software continuous integrated approach and device
CN109582645A (en) * 2018-12-14 2019-04-05 北京工业大学 A kind of nonpaperlized examination anti-cheating system
CN111026669A (en) * 2019-12-11 2020-04-17 广州品唯软件有限公司 Test log management method, test log management device, and storage medium
CN111338893A (en) * 2020-02-20 2020-06-26 深圳市腾讯计算机***有限公司 Process log processing method and device, computer equipment and storage medium
CN112182473A (en) * 2020-12-01 2021-01-05 未鲲(上海)科技服务有限公司 Page operation behavior playback method and device, computer equipment and storage medium
CN112948247A (en) * 2021-02-24 2021-06-11 携程旅游网络技术(上海)有限公司 Processing method, system, device and medium for operation playback of application program
CN113722276A (en) * 2021-09-14 2021-11-30 腾讯科技(深圳)有限公司 Log data processing method, system, storage medium and electronic equipment

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1975822A1 (en) * 2007-03-28 2008-10-01 Ricoh Company, Ltd. Method and apparatus for recording associations with logs
US20130227350A1 (en) * 2012-02-23 2013-08-29 Cadence Design Systems, Inc. Recording and playback of trace and video log data for programs
CN103092756A (en) * 2013-01-08 2013-05-08 彭勇 Interactive automated testing system and method thereof
CN106557308A (en) * 2015-09-29 2017-04-05 腾讯科技(深圳)有限公司 A kind of software continuous integrated approach and device
CN106027307A (en) * 2016-05-30 2016-10-12 努比亚技术有限公司 Device and method for recording logs of modem
CN109582645A (en) * 2018-12-14 2019-04-05 北京工业大学 A kind of nonpaperlized examination anti-cheating system
CN111026669A (en) * 2019-12-11 2020-04-17 广州品唯软件有限公司 Test log management method, test log management device, and storage medium
CN111338893A (en) * 2020-02-20 2020-06-26 深圳市腾讯计算机***有限公司 Process log processing method and device, computer equipment and storage medium
CN112182473A (en) * 2020-12-01 2021-01-05 未鲲(上海)科技服务有限公司 Page operation behavior playback method and device, computer equipment and storage medium
CN112948247A (en) * 2021-02-24 2021-06-11 携程旅游网络技术(上海)有限公司 Processing method, system, device and medium for operation playback of application program
CN113722276A (en) * 2021-09-14 2021-11-30 腾讯科技(深圳)有限公司 Log data processing method, system, storage medium and electronic equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
BURAK DÜŞÜN等: "Combat mobile malware via N-gram based deep learning", 《2018 26TH SIGNAL PROCESSING AND COMMUNICATIONS APPLICATIONS CONFERENCE (SIU)》 *
赵旭: "基于Windows日志的计算机取证模型***设计及实现", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 *
魏江涛等: "船载***日志自动分析软件的设计与实现", 《计算机测量与控制》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116795727A (en) * 2023-08-25 2023-09-22 北京安天网络安全技术有限公司 Reproduction method and device of test process, electronic equipment and storage medium
CN116795727B (en) * 2023-08-25 2023-10-27 北京安天网络安全技术有限公司 Reproduction method and device of test process, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113961534B (en) 2022-05-10

Similar Documents

Publication Publication Date Title
CN109582579B (en) Application program testing method and device, electronic equipment and storage medium
CN113448815B (en) Method for collecting and tracking trace call chain and electronic equipment
CN110413501B (en) Browser compatibility testing method, device and system and readable storage medium
US20150347263A1 (en) Function-level dynamic instrumentation
CN114371985A (en) Automated testing method, electronic device, and storage medium
CN114706633B (en) Preloading method, electronic device and storage medium
CN113961534B (en) Method and electronic equipment for generating log file
CN116339818B (en) Code change type screening method, electronic device and readable storage medium
CN113590210A (en) Class verification method and device in application program
CN112965911B (en) Interface abnormity detection method and device, computer equipment and storage medium
CN113312249A (en) Log data generation method, log data display method and device
CN112860261A (en) Static code checking method and device, computer equipment and readable storage medium
CN111265875A (en) Method and equipment for displaying game role equipment
CN116688494B (en) Method and electronic device for generating game prediction frame
CN115981711B (en) Code processing method and electronic equipment
CN117273687B (en) Card punching recommendation method and electronic equipment
CN116088955B (en) Process processing method and terminal equipment
CN113485923B (en) Project code detection method and device and electronic equipment
CN116701320B (en) Log generation method and related device
WO2024131486A1 (en) Performance analysis method, readable storage medium, program product and electronic device
CN118259803A (en) Content acquisition method and electronic equipment
CN117714271A (en) Message processing method and related device
CN118226144A (en) Abnormal sound fault identification method of electronic equipment and electronic equipment
CN117742849A (en) Interface display method and related device based on application splitting
CN115016665A (en) Freeze-screen fault detection method, electronic device and computer-readable 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