Information processing, device, terminal and storage medium

By recording and automatically adding the process number to the command, the process log is generated, which solves the log omission problem caused by the complicated and untimely manual input of the process number, and achieves the timeliness and completeness of the process log.

CN112416697BInactive Publication Date: 2024-10-01BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910780335.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-22
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When the process is running, manually entering the process number to obtain the process log is complicated and not timely, leading to the problem of missing logs.

Method used

By recording the process number of the monitored process, and adding it to the preset instructions to generate monitoring instructions when there is a need for monitoring, log information is automatically generated to ensure real-time recording and monitoring of the process number.

Benefits of technology

It reduces the complexity and untimeliness of manual operations, avoids log omissions, and improves the integrity and monitoring efficiency of process logs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112416697B_ABST
    Figure CN112416697B_ABST
Patent Text Reader

Abstract

The present disclosure is about an information processing method, device, terminal and storage medium, the method comprising: recording the process number of the monitored process; when there is a monitoring requirement, adding the recorded process number to the preset instruction of the process number parameter to generate a monitoring instruction; according to the monitoring instruction, generating the log information of the monitored process. The technical solution provided by the embodiment of the present disclosure can reduce the manual input of the process number, thereby reducing the complexity of the operation caused by the manual operation; at the same time, it can reduce the omission of the log information of the monitored process caused by the untimely manual operation when there is a monitoring requirement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to information processing, devices, terminals and storage media. Background Art

[0002] In the related art, an application will have multiple processes during operation, and each process can obtain relevant information of the process through the corresponding process monitoring log to monitor the process. If you want to obtain the log corresponding to the process, the engineer needs to manually enter the corresponding process number and execute the corresponding command. However, in the face of various situations that may occur during program operation, for example, some processes may be closed during operation, and the process number of the process that is restarted after closing, or when it is necessary to obtain the logs corresponding to more than two process numbers at the same time, if manual operation is still used, on the one hand, it will make the operation complicated; on the other hand, manual operation will inevitably lead to untimely log generation, and ultimately lead to problems such as omission of logs. Summary of the invention

[0003] According to a first aspect of an embodiment of the present disclosure, there is provided an information processing method, including:

[0004] Record the process number of the monitored process;

[0005] When there is a monitoring requirement, the recorded process number is added to the preset instruction of the process number parameter to generate a monitoring instruction;

[0006] Generate log information of the monitored process according to the monitoring instruction.

[0007] Optionally, the recording of the process number of the monitored process includes:

[0008] If the process number of the monitored process changes, the changed process number is recorded.

[0009] Optionally, the recording of the process number of the monitored process includes:

[0010] If the process number of the monitored process changes, it is determined that there is the monitoring requirement.

[0011] Optionally, the method further comprises:

[0012] Comparing the current process number of the monitored process with the historical process number to obtain a comparison result;

[0013] According to the comparison result, it is determined whether the process ID of the monitored process has changed.

[0014] Optionally, determining that the process ID of the monitored process has changed includes one of the following:

[0015] The current process number of the monitored process is not empty and the historical process number of the monitored process is empty, and it is determined that the process number of the monitored process has changed;

[0016] The current process number of the monitored process is different from the historical process number of the monitored process, and it is determined that the process number of the monitored process has changed.

[0017] Optionally, the method further comprises:

[0018] If the process number of the monitored process changes, the recorded monitoring process is closed; wherein the monitoring process is generated in order to obtain the log information corresponding to the historical process number of the monitored process.

[0019] Optionally, closing the recorded monitoring process includes:

[0020] Close the monitoring process corresponding to each process number in the monitoring process number set; the monitoring process number set includes: the process number of the monitoring process.

[0021] Optionally, the method further comprises:

[0022] Record the process number of the monitoring process generated when the log information corresponding to the historical process number of the monitored process is generated;

[0023] Determine whether the process number of the monitoring process is in the monitoring process number set;

[0024] If the process number of the monitoring process is not in the monitoring process number set, the process number of the monitoring process is recorded in the monitoring process number set.

[0025] Optionally, the method further comprises:

[0026] Read the log information and the system time information corresponding to when the log information is generated;

[0027] The log information and the corresponding system time information when the log information is generated are saved together as text information.

[0028] Optionally, the number of monitored processes includes one or more.

[0029] According to a second aspect of an embodiment of the present disclosure, there is provided an information processing device, including:

[0030] A first recording module is configured to record the process number of the monitored process;

[0031] An adding module is configured to add the recorded process number to the preset instruction of the process number parameter to generate a monitoring instruction when there is a monitoring demand;

[0032] The generation module is configured to generate log information of the monitored process according to the monitoring instruction.

[0033] Optionally, the first recording module is further configured to:

[0034] If the process number of the monitored process changes, the changed process number is recorded.

[0035] Optionally, the device further comprises:

[0036] The first determination module is configured to determine that there is the monitoring requirement if the process number of the monitored process changes.

[0037] Optionally, the device further comprises:

[0038] A comparison module is configured to compare the current process number of the monitored process with the historical process number to obtain a comparison result;

[0039] The second determining module is configured to determine whether the process ID of the monitored process has changed.

[0040] Optionally, the second determining module is further configured to:

[0041] The current process number of the monitored process is not empty and the historical process number of the monitored process is empty, and it is determined that the process number of the monitored process has changed;

[0042] The current process number of the monitored process is different from the historical process number of the monitored process, and the process number of the monitored process has changed.

[0043] Optionally, the device further comprises:

[0044] The closing module is configured to close the recorded log process if the process number of the monitored process changes; wherein the monitoring process is generated in order to obtain the log information corresponding to the historical process number of the monitored process.

[0045] Optionally, the closing module is further configured to:

[0046] If the process number of the monitored process changes, the monitoring process corresponding to each process number in the monitoring process number set is closed; the monitoring process number combination includes: the process number of the monitoring process.

[0047] Optionally, the device further comprises:

[0048] A second recording module is configured to determine whether the process ID of the monitoring process is in the monitoring process ID set;

[0049] A third determination module is configured to determine whether the process number of the monitoring process is in the monitoring process number set;

[0050] The second recording module is further configured to record the process number of the monitoring process in the monitoring process number set if the process number of the monitoring process is not in the monitoring process number set.

[0051] Optionally, the device further comprises:

[0052] A reading module, configured to read the log information and the system time information corresponding to when the log information is generated;

[0053] The saving module is configured to save the log information and the system time information corresponding to the generation of the log information together as text information.

[0054] Optionally, the number of monitored processes includes one or more.

[0055] According to a third aspect of an embodiment of the present disclosure, a terminal is provided, including:

[0056] processor;

[0057] a memory for storing processor-executable instructions;

[0058] Wherein, the processor is configured to:

[0059] Record the process number of the monitored process;

[0060] When there is a monitoring requirement, the recorded process number is added to the preset instruction of the process number parameter to generate a monitoring instruction;

[0061] Generate log information of the monitored process according to the monitoring instruction.

[0062] According to a fourth aspect of an embodiment of the present disclosure, there is provided a non-temporary computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement any of the method steps described above.

[0063] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0064] In the embodiment of the present disclosure, the execution device of the monitored process will automatically record the process number of the monitored process; when there is a monitoring requirement, the recorded process number is added to the preset instruction of the process number parameter, thereby generating a complete monitoring instruction; according to the monitoring instruction, the log information of the monitored process is generated. That is to say, since the embodiment of the present disclosure can record the process number of the monitored process, and when there is a monitoring requirement, the device can generate the monitoring instruction using the process number recorded by itself without the user manually inputting the monitored process or selecting the process number of the monitored process, and generate the log information of the monitored process through the execution of the monitoring instruction. In this way, the technical solution provided by the embodiment of the present disclosure reduces the complexity of operations caused by manual operations; and reduces the phenomenon of omission of the log information of the monitored process caused by the failure to generate the log information of the monitored process in time due to the untimely nature of manual operations when there is a monitoring requirement.

[0065] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0067] Figure 1 is a flow chart of an information processing method according to an exemplary embodiment;

[0068] Figure 2 is another flow chart of an information processing method according to an exemplary embodiment;

[0069] Figure 3 is another flow chart of an information processing method according to an exemplary embodiment;

[0070] Figure 4 is another flow chart of an information processing method according to an exemplary embodiment;

[0071] Figure 5 is a block diagram of an information processing device according to an exemplary embodiment;

[0072] Figure 6 It is a block diagram of a terminal according to an exemplary embodiment. DETAILED DESCRIPTION

[0073] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0074] Figure 1 is a flowchart of an information processing method according to an exemplary embodiment. Figure 1 As shown, the method is applied to a terminal and comprises the following steps:

[0075] Step 101: Record the process ID of the monitored process.

[0076] Here, the terminal may be a mobile terminal or a fixed terminal; the mobile terminal may be a mobile phone, a tablet computer, a laptop computer, etc.; the fixed terminal may be a desktop computer. The method may be applied to any terminal capable of running a computer program.

[0077] Here, a process is an operation of a program in a computer on a certain data set, and is the execution process of a program.

[0078] A process number is a number or a sequence number used to uniquely identify a process. The process number can be used as a parameter for a function call or as a parameter for generating certain instructions.

[0079] Here, the process number is used as a relevant parameter for generating a monitoring instruction.

[0080] Step 102: When there is a monitoring requirement, the recorded process number is added to the preset instruction of the process number parameter to generate a monitoring instruction. For example, an incomplete monitoring instruction with a missing process number is built into the terminal. By combining the recorded process number with the incomplete monitoring instruction, a monitoring instruction that can be executed by the terminal is generated.

[0081] Step 103: Generate log information of the monitored process according to the monitoring instruction.

[0082] In this embodiment, the operating system run by the terminal may be an operating system such as an Android system, a Linux system or an IOS system.

[0083] When the operating system is an Android system, the monitoring instruction may be an adb (Android Debug Bridge) command, or an adb logcat command.

[0084] When the operating system is a Linux system, the monitoring instruction may be a ps (process status) command.

[0085] In this embodiment, the terminal can determine whether there is a monitoring requirement, and when there is a monitoring requirement, it automatically adds the recorded process number to the preset instruction of the process number parameter to generate a monitoring instruction, without manually adding the process number to the process number parameter. In this way, the terminal can generate a monitoring instruction based on the process number in a timely manner when monitoring is required, so as to monitor the process corresponding to the process number in a timely manner, thereby reducing the omission of log information of the monitored process.

[0086] As an optional embodiment, the step 101, that is, recording the process number of the monitored process, includes: if the process number of the monitored process changes, recording the changed process number.

[0087] Here, the terminal can intelligently record the changed process number. Because the process number after each change is recorded by the terminal, the phenomenon that the new process number cannot be recorded in time and the related instructions cannot be generated based on the new process number as the process number parameter can be reduced, thereby improving the accuracy of the information related to the monitored process obtained based on the related instructions. Wherein, the related instructions include the monitoring instructions.

[0088] It is understandable that during the program running, some processes will inevitably be closed and then restarted. The closing and restarting of these processes will cause their process numbers to change.

[0089] As an optional embodiment, the method further includes: if the process number of the monitored process changes, determining that there is the monitoring requirement.

[0090] In this embodiment, when there is a monitoring requirement, the terminal will add the recorded process number to the preset instructions of the process number parameter to generate a monitoring instruction. When the process number of the monitored process changes, it is determined that there is the monitoring requirement, and the process number after each change can be added to the preset instructions of the process number parameter to generate a monitoring instruction, and based on the monitoring instruction, the log information corresponding to the changed process number of the monitored process is generated. In this way, the log information corresponding to each changed process number of the process can be obtained, reducing the omission of log information for the process. This makes it convenient for engineers to monitor the process through all the log information of the process.

[0091] It should be noted that the process ID of the monitored process will change as the process is restarted after being closed, but the process name of the monitored process will not change.

[0092] As an optional embodiment, the recording of the process number of the monitored process includes: obtaining the process name of the monitored process; generating a first acquisition instruction using the process name as a process name parameter; and obtaining the process number of the monitored process according to the first acquisition instruction.

[0093] For example, the first acquisition instruction may also be an adb instruction. Specifically, the first acquisition instruction may be "adb shell ps -f".

[0094] As another optional embodiment, the method further includes: comparing the current process number of the monitored process with the historical process number to obtain a comparison result; and determining whether the process number of the monitored process has changed based on the comparison result.

[0095] In one embodiment, the comparing the current process number of the monitored process with the historical process number to obtain the comparison result includes: based on the same process name and the corresponding relationship, comparing the current process number of the monitored process with the historical process number to obtain the comparison result. Here, the corresponding relationship includes: the corresponding relationship between the process name of the monitored process and each acquisition of the corresponding process number.

[0096] In this embodiment, based on the same process name, in the corresponding relationship, the comparison result is determined to determine whether the process number of the monitored process has changed. The implementation is simple, and intelligent judgment can be achieved without manual investigation, thereby improving monitoring efficiency.

[0097] In other embodiments, the historical process number can also be determined according to the parameters carried in the relevant command of the monitoring process. It can be understood that the monitoring process corresponds to the monitoring command, and the monitoring command can understand the monitoring instruction described in the above embodiment, and the monitoring instruction is generated from the preset instruction of the process number parameter. This means that according to the relevant command of the monitoring process, the historical process number of the monitored process can be obtained.

[0098] Therefore, in this embodiment, the historical process number does not need to be recorded separately in the corresponding relationship, thereby reducing the storage load of the terminal system.

[0099] As another optional embodiment, determining that the process ID of the monitored process has changed includes one of the following:

[0100] The current process number of the monitored process is not empty and the historical process number of the monitored process is empty, determining that the monitored process has changed;

[0101] The current process number of the monitored process is different from the historical process number of the monitored process, and it is determined that the process number of the monitored process has changed.

[0102] Here, the current process number of the monitored process is not empty and the historical process number of the monitored process is empty, indicating that the monitored process is started for the first time or started again at the current moment, so a current process number is assigned to the monitored process, and the current process number is a new process number, and the process number of the monitored process has changed from nothing to something. At this time, it indicates that the monitored process is in a running state, so it is necessary to monitor the running process.

[0103] It should be added that when a process is closed and then restarted, a new process number will be generated.

[0104] Here, the current process number of the monitored process is different from the historical process number of the monitored process, indicating that the monitored process has switched from the running state to the closed state and then to the running state from the historical moment to the current moment. After the monitored process has a new process number, it is also necessary to monitor the re-running process based on the new process number.

[0105] Therefore, in this embodiment, no matter whether the monitored process changes from a closed state to a restarted state, or from a running state to a closed state and then to a restarted state, it is determined that the process number of the monitored process has changed, and the monitoring instruction needs to be re-initiated to obtain the log information of the monitored process in the new state.

[0106] As an optional embodiment, the method further includes: if the process number of the monitored process changes, closing the recorded monitoring process; wherein the monitoring process is generated in order to obtain log information corresponding to the historical process number of the monitored process.

[0107] That is to say, during the execution process of generating the log information of the monitored process according to the monitoring instruction, the monitoring process will be generated.

[0108] In this embodiment, in order to optimize the system environment, it is necessary to close the redundant processes. Closing the monitoring process generated by generating log information based on the historical process number of the monitored process can optimize the system environment.

[0109] It should be supplemented that the method further includes: based on a second acquisition instruction, wherein the second acquisition instruction carries key information required for the monitoring process, such as logcat, acquiring the process number of the monitoring process.

[0110] For example, the second acquisition instruction may be a grep (Globally search a Regular Expression and Print) command. Specifically, the second acquisition instruction may be a "grep -E 'logcat" instruction.

[0111] In some embodiments, closing the recorded monitoring process includes: closing the monitoring process corresponding to each process number in a monitoring process number set; the monitoring process number set includes: the process number of the monitoring process.

[0112] In this embodiment, a monitoring process number set is introduced, and the monitoring processes corresponding to the process numbers of the monitoring processes in the monitoring process number set can be closed uniformly. In this way, the monitoring processes that were not closed in time before or were not closed last time due to system problems can be checked again, and all monitoring processes can be closed to further optimize the system.

[0113] In some other embodiments, the method further comprises:

[0114] Record the process number of the monitoring process generated when the log information corresponding to the historical process number of the monitored process is generated;

[0115] Determine whether the process number of the monitoring process is in the monitoring process number set;

[0116] If the process number of the monitoring process is not in the monitoring process number set, the process number of the monitoring process is recorded in the monitoring process number set.

[0117] Here, by recording the process number of the monitoring process generated by the log information corresponding to the historical process number of the monitored process each time, and adding the process number of the monitoring process to the monitoring process number set, the omission of the monitoring process can be reduced, so that each monitoring process can be closed to further optimize the system.

[0118] As another optional embodiment, the method further includes:

[0119] Read the log information and the system time information corresponding to when the log information is generated;

[0120] The log information and the system time information corresponding to the generation of the log information are saved together as file information.

[0121] In this embodiment, all log information of the monitored process generated based on the monitoring instructions when there is a monitoring demand and the corresponding system time information can be saved as text information, so that engineers can search and view the relevant log information of the monitored process at any time according to the text information.

[0122] Furthermore, the number of the monitored processes may be one or more than one.

[0123] It should be supplemented that, when the number of monitored processes is more than one, the recorded process number is added to the preset instruction of the process number parameter to generate a monitoring instruction, including: adding the recorded process number in parallel to the preset instruction of the process number parameter to generate a monitoring instruction, thereby realizing multi-threaded monitoring of multiple monitored processes together.

[0124] For example, when the number of monitored processes is one, the monitoring instruction may be "adb logcat+(process number of the monitored process)"; when the number of monitored processes is N, the monitoring instruction may be "adblogcat+(process number 1 of the monitored process|process number 2 of the monitored process|process number 3 of the monitored process|...|process number n of the monitored process)"; wherein N is a positive integer greater than or equal to 1; here, "|" in the acquisition command is a separator for different process numbers.

[0125] Therefore, the embodiment of the present invention can realize the intelligent generation of monitoring instructions when there is a monitored process and when there is a monitoring demand, so as to generate the log information of the monitored process. When there are multiple monitored processes, multi-threaded parallel execution can also be performed based on the same method as above, so as to obtain the log information of multiple monitored processes at the same time. This embodiment does not need to manually switch the process number, which reduces the omission of the process number caused by the need for manual switching, thereby ultimately reducing the omission of the log information of the monitored process.

[0126] Furthermore, the present disclosure also provides a specific embodiment to further understand the information processing method provided by the embodiment of the present disclosure.

[0127] Figure 2 is another flow chart of an information processing method according to an exemplary embodiment. Figure 2 As shown, the method includes:

[0128] Step 201: Record the process ID of the monitored process.

[0129] In this embodiment, the operating system of the terminal is an Android system, and the log information is a log log, wherein the log log can be understood as the log information generated by the adb logcat command described in the above embodiment. In addition, this embodiment takes multi-threaded simultaneous monitoring of N monitored processes as an example.

[0130] The step 201, i.e., recording the process number of the monitored process, may include: obtaining the process numbers of the N monitored processes of the terminal according to the command "adbshell ps -f | monitored process name 1 | monitored process name 2 | monitored process name 3 | ... | monitored process name n | '". Here, "|" in the acquisition command is a separator for different process names.

[0131] Of course, in some embodiments, the process number of the monitoring process may also be recorded while recording the process number of the monitored process.

[0132] Specifically, the process IDs of the N monitored processes of the terminal and the process ID of the logcat process can be obtained according to the command adb shell ps -f | grep -E 'logcat | monitored process name 1 | monitored process name 2 | monitored process name 3 | ... | monitored process name n | '"

[0133] Here, the logcat process should be understood as the monitoring process described in the above embodiment.

[0134] Here, the command "adb shell ps -f | grep -E 'logcat | monitored process name 1 | monitored process name 2 | monitored process name 3 | ... | monitored process name n | '" actually includes the first acquisition instruction and the second acquisition instruction described in the above embodiment.

[0135] In this embodiment, the process ID of the monitored process and the process ID of the monitoring process that previously generated log information according to the process ID of the monitored process can be obtained simultaneously through the first acquisition instruction and the second acquisition instruction included in the same command.

[0136] Step 202: If the process number of the monitored process changes, it is determined that there is the monitoring requirement.

[0137] Specifically, the terminal determines whether one or more of the process numbers of the N monitored processes have changed, and if so, executes step 203; otherwise, returns to step 201.

[0138] Here, the process number of the monitored process has changed includes: the process number of the monitored process has been created from nothing, or the process number of the monitored process has changed.

[0139] Here, the process number of the monitored process is created from nothing, which can be understood as the current process number of the monitored process described in the above embodiment is not empty and the historical process number of the monitored process is empty. The process number of the monitored process has changed, which can be understood as the current process number of the monitored process described in the above embodiment is different from the historical process number of the monitored process.

[0140] Step 203: Record the process number of the monitoring process generated when generating the log information corresponding to the historical process number of the monitoring process; determine whether the process number of the monitoring process is in the monitoring process number set; if the process number of the monitoring process is not in the monitoring process number set, record the monitoring process number in the monitoring process number set.

[0141] Specifically, the step 203 may include: if the logcat process is obtained in step 201 and the process number of the obtained logcat process is not in the "process number set for storing all logcat processes", then the process number of the logcat process obtained in step 201 is added to the "process number set for storing all logcat processes" to realize the process of recording the latest obtained process number of the monitoring process in the monitoring process number set.

[0142] Here, the "process number set storing all logcat processes" can be understood as the monitoring process number set described in the above embodiment.

[0143] Step 204: close the monitoring process corresponding to each process number in the monitoring process number set.

[0144] In this embodiment, first, each process number in the "process number set storing all logcat processes" is read, and then the "adb shell kill -9logcat's PID" command is executed to close the monitoring process corresponding to each process number in the monitoring process number set, thereby closing all monitoring processes generated when log information is generated based on the historical process number of the monitored process.

[0145] Here, each process number of the "process set storing all logcat processes" is written into the above command, and the monitoring process corresponding to each process number of the "process set storing all logcat processes" is closed to optimize the system.

[0146] Step 205: Generate log information of the monitored process according to the monitoring instruction.

[0147] In this embodiment, the log logs of all monitored processes are generated by executing the command "adb logcat|grep-E'^[0-9:.-]{18}[]+(monitored process process number 1|monitored process process number 2|monitored process process number 3|...|monitored process process number n)'>. / logcat_current system time".

[0148] Here, the process ID of the monitored process is the current process ID of the monitored process obtained from the command in step 201 .

[0149] In this implementation, through the above method steps, when there is a monitoring requirement, for example, when the process number of the monitored process changes, the latest recorded process number will be used as a parameter to execute the relevant command to obtain the log information corresponding to the current process number to obtain the log information. There is no need to manually enter and switch the process number, and the log logs of all monitored processes can be quickly obtained.

[0150] Furthermore, in some embodiments, after step 205, the obtained log and the system time information of the obtained log are redirected. It can be understood that the redirection of the obtained log and the system time information of the obtained log is equivalent to the above-mentioned embodiment of saving the log information and the system time information corresponding to the generation of the log information together as text information.

[0151] As another optional embodiment, the method further includes: determining whether the process number of the monitored process has changed according to the monitoring process command set.

[0152] In fact, the parameters of each command in the monitoring process command set include: the historical process number of the monitored process.

[0153] Specifically, Figure 3 is another flow chart of an information processing method according to an exemplary embodiment. Figure 3 As shown, the method includes:

[0154] Step 301: Record the process ID of the monitored process.

[0155] Here, the operating system of the terminal is still taken as an example of the Android system, and the log information is taken as an example of a log log, wherein the log log can be understood as the log information generated by the adb logcat command described in the above embodiment. Moreover, this embodiment takes multi-threaded simultaneous monitoring of N monitored processes as an example.

[0156] The step 301 may further include: obtaining the process number of the N monitored processes of the terminal and the process number of the logcat process and CMD (Command Prompt) according to the command "adb shell ps -f|grep -E logcat|monitored process name 1|monitored process name 2|monitored process name 3|...|monitored process name n|".

[0157] Here, the content format in CMD is logcat-PID (processID, process number). This logcat process is monitoring the process. For example, logcat--PID=16780 means that the process number of the monitored process is 16780 and a log log is being generated.

[0158] Specifically, recording the process ID of the monitored process may include the following sub-steps:

[0159] Step 1: Leave the "CMD collection for storing all logcat processes" empty and add the CMD of the current logcat process to the "CMD collection for storing all logcat processes".

[0160] Step 2: Leave the "PID collection of all logcat processes" empty and add the PIDs of all current logcat processes to the "PID collection of all logcat processes".

[0161] Step 3: Set the "PID variable storing monitored process name 1" to empty, and assign the value of the "PID variable storing monitored process name 1" to the PID of the current monitored process name 1.

[0162] Step 4: Set the "PID variable storing monitored process name 2" to empty, and assign the value of the "PID variable storing monitored process name 2" to the PID of the current monitored process name 2.

[0163] Step 5: Set the "PID variable storing monitored process name 3" to empty, and assign the value of the "PID variable storing monitored process name 3" with the PID of the current monitored process name 3.

[0164] Step 6: Until the "PID variable storing the monitored process name n" is set to empty, the "PID variable storing the monitored process name n" is assigned a value using the PID of the current monitored process name n.

[0165] Here, n is equal to N.

[0166] Step 302: If the process number of the monitored process changes, the recorded monitoring process is closed.

[0167] In this embodiment, by traversing the "set of CMDs storing all logcat processes", if the PID value of the corresponding monitored process in the set is not equal to the value of the "PID variable storing the monitored process name n", it means that the process number of the monitored process has changed, then the logcat process corresponding to the CMD is closed.

[0168] In fact, here the PID of the current monitored process name n is used to assign a value to the "PID variable storing the monitored process name n", which can actually be understood as recording the current process number of the monitored process name n in the "PID variable storing the monitored process name n".

[0169] Furthermore, the PID variable of the monitored process name n can be used as a process number parameter of a preset instruction, thereby generating log information corresponding to the current process number of the monitored process based on the PID variable of the monitored process name n.

[0170] Furthermore, this embodiment also provides a specific method for generating log information of the monitored process.

[0171] Specifically, Figure 4 is another flow chart of an information processing method according to an exemplary embodiment. Figure 4 As shown, the method includes:

[0172] Step 401: Determine whether the process number of the monitored process has changed, if so, execute step 402, otherwise, execute step 404.

[0173] Here, the step 401 may include: determining whether the "PID variable storing the monitored process name n" is not empty and is not in the process PID corresponding to each CMD in the "set of CMDs storing all logcat processes", if so, executing step 402, otherwise executing step 403.

[0174] Step 402: Generate log information of the monitored process according to the monitoring instruction.

[0175] Here, if it is determined that the process number of the monitored process has changed, it is determined that there is a monitoring requirement, and step 402 is executed.

[0176] The step 402 may include: executing the command "adb logcat --PID="value of the PID variable storing the monitored process name n"", which returns an output stream.

[0177] Here, the output stream is the log information corresponding to the PID variable of the monitored process name n described in the above embodiment.

[0178] Furthermore, in this embodiment, the method may also include: adding the "PID variable storing the monitored process name n" to the process PID corresponding to the CMD in the "set storing the CMDs of all logcat processes", so that the process number of the corresponding monitored process can be found according to the CMD of the logcat process.

[0179] Step 403: Determine whether log information is generated. If no log information is output or empty information is output, execute step 402; otherwise, execute step 404.

[0180] Specifically, here, the step 403 may include: if the terminal determines whether the output stream is empty or the output content is empty, then executing step 402; otherwise, executing step 404.

[0181] It is understandable that the judgment in step 401 is no, that is, the "PID variable storing the monitored process name n" is not empty and in the "set of CMDs storing all logcat processes", each CMD corresponds to the process PID, that is, the PID of the current monitored process name n has not changed. At this time, if you need to obtain the log information of the monitored process n that has not changed, you only need to find the CMD corresponding to the PID from the original CMD set to determine the output stream, which is the log information of the monitored process n.

[0182] In this step, it is determined again whether the output stream is empty or the output content is empty. If yes, the process returns to step 402 . If no, the process executes step 404 .

[0183] Step 404: Read the log information and generate system time information corresponding to the log information.

[0184] Specifically, the step 404 may include: reading the content output by the output stream to complete the monitoring of the logcat of the monitored process n.

[0185] This embodiment provides a method for generating the log information of the monitored process, that is, when the process number of the monitored process has not changed, the previously generated log information can be directly extracted as the log information of the monitored process, so that there is no need to re-execute the log generation command, thereby reducing the system burden.

[0186] Figure 5 is a block diagram of an information processing device according to an exemplary embodiment. Figure 5 , the device comprises a first determining module 51, an adding module 52 and a generating module 53;

[0187] The first recording module 51 is configured to record the process number of the monitored process;

[0188] The adding module 52 is configured to add the recorded process number to the preset instruction of the process number parameter to generate a monitoring instruction when there is a monitoring demand;

[0189] The generating module 53 is configured to generate log information of the monitored process according to the monitoring instruction.

[0190] In an optional embodiment, the first recording module 51 is further configured to:

[0191] If the process number of the monitored process changes, the changed process number is recorded.

[0192] In an optional embodiment, the device further comprises:

[0193] The first determination module is configured to determine that there is the monitoring requirement if the process number of the monitored process changes.

[0194] In an optional embodiment, the device further comprises:

[0195] A comparison module is configured to compare the current process number of the monitored process with the historical process number to obtain a comparison result;

[0196] The second determining module is configured to determine whether the process ID of the monitored process has changed.

[0197] In an optional embodiment, the second determining module is further configured to:

[0198] The current process number of the monitored process is not empty and the historical process number of the monitored process is empty, and it is determined that the process number of the monitored process has changed;

[0199] The current process number of the monitored process is different from the historical process number of the monitored process, and it is determined that the process number of the monitored process has changed.

[0200] In an optional embodiment, it is characterized in that the device further comprises:

[0201] The closing module is configured to close the recorded monitoring process if the process number of the monitored process changes; wherein the monitoring process is generated in order to obtain the log information corresponding to the historical process number of the monitored process.

[0202] In an optional embodiment, the closing module is further configured to:

[0203] If the process number of the monitored process changes, the monitoring process corresponding to each process number in the monitoring process number set is closed; the monitoring process number set includes: the process number of the monitoring process.

[0204] In an optional embodiment, the device further comprises:

[0205] A second recording module is configured to record the process number of the monitoring process generated when the log information corresponding to the historical process number of the monitored process is generated;

[0206] A third determination module is configured to determine whether the process number of the monitoring process is in the monitoring process number set;

[0207] The second recording module is further configured to record the process number of the monitoring process in the monitoring process number set if the process number of the monitoring process is not in the monitoring process number set.

[0208] In an optional embodiment, the device further comprises:

[0209] A reading module, configured to read the log information and the system time information corresponding to when the log information is generated;

[0210] The saving module is configured to save the log information and the system event information corresponding to the generation of the log information together as text information.

[0211] In an optional embodiment, the number of monitored processes includes one or more.

[0212] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0213] Figure 6 6 is a block diagram of a terminal 600 according to an exemplary embodiment. For example, the terminal 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0214] Reference Figure 6 The terminal 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .

[0215] The processing component 602 generally controls the overall operation of the terminal 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.

[0216] The memory 604 is configured to store various types of data to support operations at the terminal 600. Examples of such data include instructions for any application or method operating on the terminal 600, contact data, phone book data, messages, pictures, videos, etc. The memory 804 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0217] Power component 606 provides power to various components of terminal 600. Power component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to terminal 600.

[0218] The multimedia component 608 includes a screen that provides an output interface between the terminal 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the terminal 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0219] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 610 includes a microphone (MIC), and when the terminal 600 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.

[0220] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0221] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the terminal 600. For example, the sensor assembly 614 can detect the open / closed state of the terminal 600, the relative positioning of the components, such as the display and keypad of the terminal 600, and the sensor assembly 614 can also detect the position change of the terminal 600 or a component of the terminal 6000, the presence or absence of contact between the user and the terminal 600, the orientation or acceleration / deceleration of the terminal 600 and the temperature change of the terminal 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.

[0222] The communication component 616 is configured to facilitate wired or wireless communication between the terminal 600 and other devices. The terminal 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0223] In an exemplary embodiment, terminal 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0224] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by a processor 620 of a terminal 600 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0225] A non-temporary computer-readable storage medium, when instructions in the storage medium are executed by a processor of a terminal, enables the terminal to execute the information processing method described in the above embodiments.

[0226] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0227] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. An information processing method, characterized in that: include: Record the process number of the monitored process; If the process number of the monitored process changes, it is determined that there is a monitoring requirement; If the process number of the monitored process changes, close the recorded monitoring process; wherein the monitoring process is generated to obtain the log information corresponding to the historical process number of the monitored process; The closing of the recorded monitoring process includes: Shut down the monitoring process corresponding to each process number in the monitoring process number set; the monitoring process number set includes: the process number of the monitoring process; Record the process number of the monitoring process generated when the log information corresponding to the historical process number of the monitored process is generated; Determine whether the process number of the monitoring process is in the monitoring process number set; If the process number of the monitoring process is not in the monitoring process number set, then the process number of the monitoring process is recorded in the monitoring process number set; When there is a monitoring requirement, the recorded process number is added to the preset instruction of the process number parameter to generate a monitoring instruction; Generate log information of the monitored process according to the monitoring instruction.

2. The method according to claim 1, characterized in that The process number of the monitored process is recorded, including: If the process number of the monitored process changes, the changed process number is recorded.

3. The method according to claim 1, characterized in that The method further comprises: Comparing the current process number of the monitored process with the historical process number to obtain a comparison result; According to the comparison result, it is determined whether the process ID of the monitored process has changed.

4. The method according to claim 3, characterized in that Determining that the process ID of the monitored process has changed includes one of the following: The current process number of the monitored process is not empty and the historical process number of the monitored process is empty, and it is determined that the process number of the monitored process has changed; The current process number of the monitored process is different from the historical process number of the monitored process, and it is determined that the process number of the monitored process has changed.

5. The method according to claim 1, characterized in that The method further comprises: Read the log information and the system time information corresponding to when the log information is generated; The log information and the system time information corresponding to the generation of the log information are saved together as text information.

6. The method according to claim 1, characterized in that The number of the monitored processes includes one or more.

7. An information processing device, characterized in that: include: A first recording module is configured to record the process number of the monitored process; A first determination module is configured to determine that there is a monitoring requirement if the process number of the monitored process changes; wherein the monitoring process is generated to obtain log information corresponding to the historical process number of the monitored process; A closing module, configured to close the recorded monitoring process if the process number of the monitored process changes; The closing of the recorded monitoring process includes: if the process number of the monitored process changes, closing the monitoring process corresponding to each process number in the monitoring process number set; the monitoring process number set includes: the process number of the monitoring process; A second recording module is configured to record the process number of the monitoring process generated when the log information corresponding to the historical process number of the monitored process is generated; A third determination module is configured to determine whether the process number of the monitoring process is in the monitoring process number set; The second recording module is further configured to record the process number of the monitoring process in the monitoring process number set if the process number of the monitoring process is not in the monitoring process number set; An adding module is configured to add the recorded process number to a preset instruction of a process number parameter to generate a monitoring instruction when there is a monitoring demand; The generation module is configured to generate log information of the monitored process according to the monitoring instruction.

8. The device according to claim 7, characterized in that The first recording module is further configured to: If the process number of the monitored process changes, the changed process number is recorded.

9. The device according to claim 8, characterized in that The device also includes: A comparison module is configured to compare the current process number of the monitored process with the historical process number to obtain a comparison result; The second determining module is configured to determine whether the process ID of the monitored process has changed.

10. The device according to claim 9, characterized in that The second determining module is further configured to: The current process number of the monitored process is not empty and the historical process number of the monitored process is empty, and it is determined that the process number of the monitored process has changed; The current process number of the monitored process is different from the historical process number of the monitored process, and it is determined that the process number of the monitored process has changed.

11. The device according to claim 7, characterized in that The device also includes: A reading module, configured to read the log information and the system time information corresponding to when the log information is generated; The saving module is configured to save the log information and the system event information corresponding to the generation of the log information together as text information.

12. The device according to claim 7, characterized in that The number of the monitored processes includes one or more.

13. A terminal, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to: Record the process number of the monitored process; When there is a monitoring requirement, the recorded process number is added to the preset instruction of the process number parameter to generate a monitoring instruction; Generate log information of the monitored process according to the monitoring instruction.

14. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method steps of any one of claims 1 to 6.