Object information processing method and device, equipment and storage medium
By using detection functions on the mobile terminal to detect and obtain object information created by the client, the inefficiency and inconvenience in the existing methods are solved, and efficient object inspection and management are achieved.
Patent Information
- Application Number
- CN202310936988.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-27
- Publication Date
- 2025-02-07
AI Technical Summary
When developing a mobile terminal client, developers need to check the created objects to find potential problems, but existing methods require connecting the mobile terminal to the computer, which is inefficient and inconvenient.
Provides a method of processing object information, using detection functions to detect objects created by the client on the mobile terminal, and obtain object information, including class name and memory usage, and display object information in response to query instructions.
It realizes efficient detection and inspection of objects created by clients on mobile terminals, without relying on connections from other terminals, and improves the efficiency of object inspection.
Smart Images

Figure CN119396702A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and storage medium for processing object information. Background Art
[0002] In the process of developing a client for a mobile terminal, developers need to create objects to implement client functions. However, in the process of creating objects, problems may occur, causing the client to run abnormally.
[0003] Developers need to check objects created in the client in order to find objects with problems in time. Currently, the mobile terminal needs to be connected to a computer, and the developer uses a program in the computer to detect and check the objects created by the client installed in the mobile terminal. The process of developers using a computer to check objects created by the client of the mobile terminal is inconvenient, and the efficiency of checking the created objects is low. Summary of the invention
[0004] In view of this, the present application provides a method, apparatus, device and storage medium for processing object information, which can detect objects created by a client on a mobile terminal and obtain object information, thereby facilitating the inspection of the created objects and improving the efficiency of inspecting objects.
[0005] Based on this, the technical solutions provided by this application are as follows:
[0006] In a first aspect, the present application provides a method for processing object information, the method being applied to a client installed on a mobile terminal, the method comprising:
[0007] Using a detection function to detect the object created by the client, the detection function is called based on a function symbol of the detection function, and the function symbol of the detection function is obtained by querying a system dynamic library of the mobile terminal;
[0008] If a created object is detected, obtaining object information of the object, the object information including the class name of the object and the memory usage of the object;
[0009] In response to obtaining a query instruction for the object information, the object information is displayed.
[0010] In a possible implementation manner, the object information further includes the stack, and the stack is obtained according to a stack sampling frequency, and the stack sampling frequency is independently configured.
[0011] In a possible implementation manner, before acquiring the object information of the object, the method further includes:
[0012] It is determined that the object satisfies an information acquisition condition.
[0013] In a possible implementation, the information acquisition condition includes one or more of: a memory usage required to create the object is greater than or equal to a memory usage threshold, and a frequency of creating the object is greater than or equal to a frequency threshold.
[0014] In a possible implementation manner, after acquiring the object information of the object, the method further includes:
[0015] Aggregation processing is performed on the object information according to an aggregation type, where the aggregation type includes one or more of a class name and a stack.
[0016] In a possible implementation, the client is connected to the server, and the method further includes:
[0017] The object information is sent to the server, where the object information is used to be displayed when the server queries the object information.
[0018] In a possible implementation manner, before sending the object information to the server, the method further includes:
[0019] Determine whether the object information meets an abnormality reporting condition.
[0020] In one possible implementation, the object information also includes one or more of the current scene of the object, the thread where the object is located, whether the object triggers garbage collection, the duration of garbage collection, sampling information of the object information, resource usage information of the client, and business information of the client.
[0021] In a second aspect, the present application provides a device for processing object information, the device being applied to a client installed in a mobile terminal, the device comprising:
[0022] a detection unit, configured to detect the object created by the client using a detection function, wherein the detection function is called based on a function symbol of the detection function, and the function symbol of the detection function is obtained by querying a system dynamic library of the mobile terminal;
[0023] an acquiring unit, configured to acquire object information of the object if a created object is detected, the object information including a class name of the object and a memory usage of the object;
[0024] The display unit is used to display the object information in response to obtaining a query instruction for the object information.
[0025] In a possible implementation manner, the object information further includes the stack, and the stack is obtained according to a stack sampling frequency, and the stack sampling frequency is independently configured.
[0026] In a possible implementation manner, the device further includes:
[0027] The first determining unit is used to determine whether the object meets the information acquisition condition.
[0028] In a possible implementation, the information acquisition condition includes one or more of: a memory usage required to create the object is greater than or equal to a memory usage threshold, and a frequency of creating the object is greater than or equal to a frequency threshold.
[0029] In a possible implementation manner, the device further includes:
[0030] The aggregation unit is used to perform aggregation processing on the object information according to an aggregation type, where the aggregation type includes one or more of a class name and a stack.
[0031] In a possible implementation, the client is connected to the server, and the device further includes:
[0032] A sending unit is used to send the object information to the server, and the object information is used to be displayed when the object information is queried based on the server.
[0033] In a possible implementation manner, before sending the object information to the server, the device further includes:
[0034] The second determining unit is used to determine whether the object information meets the abnormal reporting condition.
[0035] In one possible implementation, the object information also includes one or more of the current scene of the object, the thread where the object is located, whether the object triggers garbage collection, the duration of garbage collection, sampling information of the object information, resource usage information of the client, and business information of the client.
[0036] In a third aspect, the present application provides an electronic device, including:
[0037] one or more processors;
[0038] a storage device having one or more programs stored thereon,
[0039] When the one or more programs are executed by the one or more processors, the one or more processors implement any method described in the first aspect.
[0040] In a fourth aspect, the present application provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, any method described in the first aspect is implemented.
[0041] In a fifth aspect, the present application provides a computer program product, which, when executed on a device, enables the device to execute any method described in the first aspect.
[0042] It can be seen that this application has the following beneficial effects:
[0043] The present application provides a method, device, equipment and storage medium for processing object information. The method is applied to a client installed on a mobile terminal. The method first uses a detection function to detect an object created by the client, wherein the detection function is called based on a function symbol of the detection function, and the function symbol of the detection function is queried from a system dynamic library of the mobile terminal. If the created object is detected using the detection function, the object information of the object is obtained. The object information includes the class name of the object and the memory usage of the object. In response to a query instruction for obtaining object information, the object information is displayed. In this way, it is possible to detect objects created by the client on the mobile terminal where the client is installed, without being limited to the method of using other terminals to detect objects created by the client of the mobile terminal, which facilitates the inspection of objects created by the client. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of a framework of an exemplary application scenario provided in an embodiment of the present application;
[0045] Figure 2 A flowchart of a method for processing object information provided in an embodiment of the present application;
[0046] Figure 3 A flowchart of a method for determining whether to trigger garbage collection provided in an embodiment of the present application;
[0047] Figure 4 A schematic diagram of the structure of an object information processing device provided in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of the basic structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to facilitate the understanding and explanation of the technical solutions provided by the embodiments of the present application, the background technology of the present application will be described below.
[0050] When a developer develops a client for a mobile terminal, he or she will create objects in the program to implement the functions of the client. However, there may be problems with the created objects. The developer needs to test the operation of the client, obtain relevant information about the created objects, and check the created objects in order to find objects with problems. At present, the developer needs to connect the mobile terminal to which the tested client is applied to a computer. The computer program is used to obtain relevant information about the objects created by the client in the mobile terminal. However, this method is limited by the usage scenario and can only be operated offline. In addition, in the process of using a computer to obtain relevant information about the objects created by the client in the mobile terminal, that is, in the process of detecting the created objects, more computing resources will be consumed. This will make the process of using a computer to detect the objects created by the client in the mobile terminal inconvenient.
[0051] Based on this, an embodiment of the present application provides a method, device, equipment and storage medium for processing object information. The method is applied to a client installed on a mobile terminal. The method first uses a detection function to detect an object created by the client, wherein the detection function is called based on a function symbol of the detection function, and the function symbol of the detection function is queried from a system dynamic library of the mobile terminal. If the created object is detected using the detection function, the object information of the object is obtained. The object information includes the class name of the object and the memory usage of the object. In response to obtaining a query instruction for the object information, the object information is displayed. In this way, it is possible to detect objects created by the client on the mobile terminal where the client is installed, without being limited to the method of using other terminals to detect objects created by the client of the mobile terminal, which facilitates the inspection of objects created by the client.
[0052] In order to facilitate understanding of a method for processing object information provided in an embodiment of the present application, Figure 1 See the example scenario shown in the figure. Figure 1 As shown, this figure is a schematic diagram of the framework of an exemplary application scenario provided by an embodiment of the present application. The method can be applied to a client installed in a mobile terminal. The mobile terminal is, for example, a mobile phone or a tablet computer.
[0053] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.
[0054] In actual applications, an initialization step is performed in advance, and the function symbol of the detection function is queried from the system dynamic library of the mobile terminal. The function symbol of the detection function is used to represent the detection function. The detection function is called using the function symbol of the detection function. The detection function is used to detect the created object. After the created object is detected by calling the detection function, the object information of the created object is obtained. In this way, the mobile terminal can be used to detect the object created by the client. When the query instruction for the object information is obtained, the object information is displayed. In this way, it is convenient for developers to view the object information in the mobile terminal, determine whether there is a problem with the object created by the client, and eliminate the problem of the client in time.
[0055] In order to facilitate understanding of the technical solution provided by the embodiment of the present application, a method for processing object information provided by the embodiment of the present application is described below with reference to the accompanying drawings.
[0056] See also Figure 2 As shown in FIG. 1 , this figure is a flow chart of a method for processing object information provided by an embodiment of the present application, and the method is applied to a client installed in a mobile terminal. Figure 2 As shown, the method may include S201-S203:
[0057] S201: Detect objects created by the client using a detection function.
[0058] The detection function is a program that is called in advance to detect the created object. The detection function can be called based on the function symbol of the detection function. Among them, the function symbol of the detection function is stored in the system dynamic library of the mobile terminal and can be queried from the system dynamic library of the mobile terminal. It is more convenient to call the detection function based on the function symbol of the system dynamic library. As an example, when starting to detect the created object, first determine whether to execute the initialization step. The initialization step includes calling the detection function. If the initialization step is not executed, the initialization step is executed and the detection function is called. For example, the initialization step includes obtaining the symbol name of the function symbol of the detection function (SetAllocationListener), obtaining the heap pointer, and calling the SetAllocationListener function. As an example, an embodiment of the present application provides a specific implementation method for calling the detection function based on the system dynamic library of the mobile terminal. The system dynamic library of the mobile terminal is libart.so. libart.so includes function symbols of multiple functions. Get the function symbol of SetAllocationListener from the libart.so library.
[0059] The method for obtaining function symbols includes the following two steps:
[0060] 1. Use the command to obtain the symbol name.
[0061] 2. Use the dlopen library to obtain the symbol address according to the symbol name at runtime. The dlopen library can be replaced by other libraries with similar functions.
[0062] 3. Use dlsym_symtab to obtain function symbols and call function symbols.
[0063] As an example, the code for obtaining and calling function symbols using dlsym_symtab is as follows:
[0064]
[0065]
[0066] The object created by the client is an object that implements the program run by the client. For example, it is a Java object. The object created by the client can be an object automatically created during the running of the program, or it can be an object created based on an instruction to create the object. The embodiment of the present application does not limit this. The object creation interface is called each time an object is created. The detection function detects the operation of calling the object creation interface to realize the detection of the created object.
[0067] The embodiments of the present application do not limit the implementation method of triggering the detection function to start detecting objects created in the client. In one possible implementation method, a sampling switch is configured in the client. Developers can start the detection of the created objects by triggering the detection function by triggering the sampling switch. As another possible implementation method, the detection time is pre-configured. When the configured detection time is reached, the detection function is triggered to detect the created objects. As another possible implementation method, developers can use the server to send a trigger instruction to the client to start detecting the created objects. After the client obtains the instruction, the detection function is triggered to detect the created objects.
[0068] S202: If a created object is detected, object information of the object is obtained, where the object information includes a class name of the object and a memory usage of the object.
[0069] The object information includes at least two sub-information: the class name of the object and the memory usage of the object. An object is an instance of a class. The class name of the object is the name of the class to which the object belongs. The memory usage of the object is the size of the memory occupied by the created object. Other contents included in the object information can be configured based on the need to check the created object.
[0070] As an example, the object information also includes other sub-information. For example, the object information also includes: one or more of the current scene of the object, the stack, the thread where the object is located, whether the object triggers garbage collection, the duration of garbage collection, sampling information of the object information, resource usage information of the client, and business information of the client.
[0071] Among them, the current scene of the object is used to mark the current scene name. The stack is the stack of the created object. The thread where the object is located is the thread where the created object is located. Whether the object triggers garbage collection is used to indicate whether the creation of the object triggers garbage collection (GC). In the case where the object triggers garbage collection, the duration of garbage collection can also be obtained. The sampling information of the object information is the relevant information for obtaining the sampling of the object information. The sampling information of the object information includes, for example, one or more of the sampling start time, the sampling end time and the sampling frequency. The resource usage information of the client is the information of the resource application of the current client. The resource usage information of the client includes, for example, one or more of the total memory of the client and the remaining memory of the heap. The business information of the client is the business information related to the created object. For example, the client is a video playback application. The created object belongs to the video playback scene. The business information of the client is the type of video being played by the client when the object is created.
[0072] The methods for obtaining different types of sub-information may be different. As some possible implementation methods, the embodiments of the present application respectively provide implementation methods for obtaining the class name of the object, the memory usage of the object, the stack, the thread where the object is located, whether the object triggers garbage collection, and the duration of garbage collection. Please refer to the following for details.
[0073] S203: In response to obtaining a query instruction for object information, display the object information.
[0074] The acquired object information can be used for query display, which makes it easy for developers to query object information on mobile terminals and implement inspection and management of objects created by clients.
[0075] The query instruction for object information is used to query the object information. The embodiment of the present application does not limit the method of triggering the query instruction for object information. In one possible implementation, the acquired object information is stored in a pre-set storage space. The query instruction for object information can be an access instruction for the storage space. In another possible implementation, the query instruction for object information is an instruction including query information input by the user, that is, the developer. The query information is used to filter the object information of this query from the object information that has been acquired. The query information is, for example, the class name of the object.
[0076] It should be noted that in some implementations, after obtaining the object information, the object information is first sorted out to facilitate subsequent processing of the object information. As an example, the object information is aggregated according to the aggregation type. The aggregation type includes one or more of the class name and the stack. For example, the obtained object information is aggregated according to the type, and the object information of the same class name is aggregated into an object information set. For another example, when the object information includes a stack, the obtained object information is aggregated according to the stack, and the object information of the same stack is aggregated into an object information set. For another example, when the object information includes a stack, the obtained object information is aggregated according to the class name and the stack. Object information of the same class name and the same stack is aggregated into an object information set. The aggregated object information is stored. The aggregated object information is convenient for subsequent processing, such as querying or reporting to a server.
[0077] In addition, the object information can also be stored locally in the mobile terminal. The storage method for storing the object information is preconfigured. For example, the storage space for storing the object information and the storage data format of the object information are configured. The object information is stored according to the preconfigured storage method.
[0078] Based on the above S201-S203, it can be known that by detecting the object created by the client, the object information of the created object can be obtained more conveniently, thereby improving the efficiency of developers in obtaining the object information of the created object. Developers can view the object information more conveniently on the mobile terminal and find problems with the created object in time. This can improve the efficiency of testing or optimizing the client.
[0079] As some possible implementation methods, the embodiments of the present application respectively provide implementation methods for obtaining the class name of the object, the memory usage of the object, the stack, the thread where the object is located, whether the object triggers garbage collection, and the duration of garbage collection.
[0080] First: Get the class name of the object.
[0081] Get the class pointer through the object pointer. The class pointer is stored in the header address of the object. After getting the class pointer, call the _ZN3art6mirror5Class16PrettyDescriptorEv function symbol obtained from the system dynamic library to implement the function of calling the class name to get the class name of the object.
[0082] As an example, the implementation code for getting the class name is as follows:
[0083]
[0084]
[0085] Second: Get the memory usage of the object.
[0086] To obtain the memory usage of an object, refer to the code for obtaining and calling function symbols using dlsym_symtab: s_monitor->ObjectAllocated(self,obj,byte_count), where byte_count represents the memory usage of the object.
[0087] Third: Get the stack.
[0088] Use libunwind to obtain the stack, or use jni to call the stack printing function of the java layer to obtain the stack.
[0089] Fourth: Get the thread where the object is located.
[0090] The _ZNK3art6Thread13GetThreadNameERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE function symbol is called through the thread pointer. This function symbol corresponds to the function for getting the thread.
[0091]
[0092] Fifth: Determine whether the object triggers garbage collection and how long the garbage collection will take.
[0093] During the process of creating an object, garbage collection may be triggered. The conditions for triggering garbage collection are different for different types of objects. As an example, objects are divided into large objects or small objects based on memory usage. Objects with a memory usage greater than or equal to 4kb (Kilobyte) are determined as large objects, and objects with a memory usage less than or equal to 4kb are determined as small objects. See Figure 3 As shown, Figure 3A flow chart of a method for determining whether to trigger garbage collection is provided in an embodiment of the present application. For large objects, determine whether the number of pre-allocated (PreObjectAllocated) calls is greater than or equal to 2 times. If the number of pre-allocated calls is greater than or equal to 2 times, it is determined that garbage collection exists. If the number of pre-allocated calls is less than 2 times, it is determined that garbage collection does not exist. For small objects, determine whether the number of pre-allocated calls is greater than or equal to 3 times. If the number of pre-allocated calls is greater than or equal to 3 times, it is determined that garbage collection exists. If the number of pre-allocated calls is less than 3 times, it is determined that garbage collection does not exist. After determining that garbage collection exists, obtain the duration of garbage collection. The duration of garbage collection is the difference between the object allocation timestamp and the first pre-allocation timestamp.
[0094] In the case where the data volume of all object information generated by creating an object is large, a sampling frequency for obtaining the object information is pre-configured. The object information of the object is obtained according to the pre-configured sampling frequency. It should be noted that for object information including multiple types of sub-information, the data volume of each sub-information is different. In some possible implementations, the sampling frequency corresponding to different types of sub-information can be independently configured for the sub-information of the type. The sampling frequencies corresponding to different types of sub-information can be the same or different.
[0095] As an example, the object information includes a stack. The stack is sub-information included in the object information. Obtaining the stack consumes a lot of resources. For this reason, the stack sampling frequency can be pre-set for the stack. When obtaining the object information, the stack is obtained based on the stack sampling frequency. In this way, the frequency of obtaining the stack can be controlled by using the stack sampling frequency, which can save resources for obtaining the stack and reduce the impact of obtaining the stack on the normal operation of the client.
[0096] In some possible implementations, for each object created by the client, the object information of the object is obtained. In other possible implementations, the client creates more objects. If the object information of each object is obtained, the amount of data of the object information to be obtained is large. The information acquisition conditions are preconfigured. The information acquisition conditions are used to determine the objects for which the object information needs to be obtained. Before obtaining the object information of the object, the client determines that the object meets the information acquisition conditions. In this way, the created objects can be screened, and the object information of the objects that may have problems in the created objects can be obtained. On the basis of being able to find the objects with problems, the resources consumed in obtaining the object information can be reduced, and the efficiency of obtaining the object information can be improved.
[0097] The embodiments of the present application do not limit the specific content included in the information acquisition conditions. As an example, the information acquisition condition is that the created object is an abnormal object. An abnormal object is an object that may have problems. The abnormal object can be determined by the memory usage required to create the object or the frequency of creating the object. For example, the information acquisition condition includes one or more of the memory usage required to create the object is greater than or equal to the usage threshold, and the frequency of creating the object is greater than or equal to the frequency threshold. If the memory usage required to create the object is greater than or equal to the usage threshold, it means that the memory usage of the object is large and there may be problems. If the frequency of creating the object is greater than or equal to the frequency threshold, it means that the creation frequency of the object is high and there may be problems.
[0098] After the client obtains and stores the object information, the client can also send the object information to the server. The client and the server establish a connection in advance to interact with the data. In this way, the developer can query the object information on the server, which is convenient for the developer to query the object information and find the created objects with problems in time.
[0099] The embodiment of the present application does not limit the manner in which the client sends object information to the server. In a possible implementation, a communication protocol is pre-configured in the client and the server. Based on the communication protocol, the client sends a message including the object information to the server.
[0100] For clients with different reporting frameworks, the way of sending object information to the server is different. As an example, for a client with a reporting framework at the Java layer, the object information is first processed based on the native (local service) layer, such as the above-mentioned aggregation processing. Then the processed object information is passed to the Java layer. The Java layer implements communication with the server. As another example, for a client with a reporting framework at the native layer, that is, a client with a reporting framework implemented using C++, it is possible to communicate with the server at the native layer and report object information to the server.
[0101] In addition, the embodiments of the present application do not limit the triggering conditions for the client to send object information to the server. In one possible implementation, the client sends object information to the server at a fixed time. In another possible implementation, after determining that the object information meets the abnormal reporting conditions, the object information is sent to the server. Among them, the abnormal reporting conditions are conditions for judging whether the created object is abnormal based on the object information. As an example, the abnormal reporting conditions include that the memory usage of the created object is greater than or equal to the abnormal usage threshold, and the frequency of creating the object is greater than or equal to the abnormal frequency threshold. Reporting the object information to the server after the abnormal reporting conditions are met can reduce the usage of communication resources between the server and the client and save network resources.
[0102] Based on the object information processing method provided by the above method embodiment, the present application embodiment further provides an object information processing device, which is applied to a client installed in a mobile terminal. The object information processing device will be described below in conjunction with the accompanying drawings.
[0103] See also Figure 4 As shown in FIG. 1 , this figure is a schematic diagram of the structure of an object information processing device provided in an embodiment of the present application. Figure 4 As shown, the object information processing device includes:
[0104] A detection unit 401 is used to detect the object created by the client using a detection function, wherein the detection function is called based on a function symbol of the detection function, and the function symbol of the detection function is obtained by querying a system dynamic library of the mobile terminal;
[0105] An acquiring unit 402 is configured to acquire object information of the object if a created object is detected, the object information including a class name of the object and a memory usage of the object;
[0106] The display unit 403 is configured to display the object information in response to obtaining a query instruction for the object information.
[0107] In a possible implementation manner, the object information further includes the stack, and the stack is obtained according to a stack sampling frequency, and the stack sampling frequency is independently configured.
[0108] In a possible implementation manner, the device further includes:
[0109] The first determining unit is used to determine whether the object meets the information acquisition condition.
[0110] In a possible implementation, the information acquisition condition includes one or more of: a memory usage required to create the object is greater than or equal to a memory usage threshold, and a frequency of creating the object is greater than or equal to a frequency threshold.
[0111] In a possible implementation manner, the device further includes:
[0112] The aggregation unit is used to perform aggregation processing on the object information according to an aggregation type, where the aggregation type includes one or more of a class name and a stack.
[0113] In a possible implementation, the client is connected to the server, and the device further includes:
[0114] A sending unit is used to send the object information to the server, and the object information is used to be displayed when the object information is queried based on the server.
[0115] In a possible implementation manner, before sending the object information to the server, the device further includes:
[0116] The second determining unit is used to determine whether the object information meets the abnormal reporting condition.
[0117] In one possible implementation, the object information also includes one or more of the current scene of the object, the thread where the object is located, whether the object triggers garbage collection, the duration of garbage collection, sampling information of the object information, resource usage information of the client, and business information of the client.
[0118] Based on the object information processing method provided by the above method embodiment, the present application also provides an electronic device, including: one or more processors; a storage device, on which one or more programs are stored, when the one or more programs are executed by the one or more processors, the one or more processors implement the object information processing method as described in any of the above embodiments.
[0119] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present application. The terminal device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (portable android devices), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs (televisions), desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0120] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0121] Typically, the following devices may be connected to the I / O interface 505: an input device 508 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0122] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present application are executed.
[0123] The electronic device provided in the embodiment of the present application and the method for processing object information provided in the above embodiment belong to the same inventive concept. For technical details not fully described in this embodiment, reference can be made to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0124] Based on a method for processing object information provided in the above method embodiment, an embodiment of the present application provides a computer storage medium on which a computer program is stored, wherein when the program is executed by a processor, the method for processing object information as described in any of the above embodiments is implemented.
[0125] It should be noted that the computer-readable medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0126] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0127] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0128] The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device executes the object information processing method.
[0129] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0131] The units involved in the embodiments described in this application may be implemented by software or hardware. The name of a unit / module does not limit the unit itself in some cases. For example, a voice data acquisition module may also be described as a "data acquisition module".
[0132] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0133] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0134] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0135] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0136] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0137] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing object information, characterized in that: The method is applied to a client installed in a mobile terminal, and the method comprises: Using a detection function to detect the object created by the client, the detection function is called based on a function symbol of the detection function, and the function symbol of the detection function is obtained by querying a system dynamic library of the mobile terminal; If a created object is detected, obtaining object information of the object, the object information including the class name of the object and the memory usage of the object; In response to obtaining a query instruction for the object information, the object information is displayed.
2. The method according to claim 1, characterized in that: The object information also includes the stack, which is obtained according to a stack sampling frequency, and the stack sampling frequency is independently configured.
3. The method according to claim 1, characterized in that Before obtaining the object information of the object, the method further includes: It is determined that the object satisfies an information acquisition condition.
4. The method according to claim 3, characterized in that The information acquisition condition includes one or more of: a memory occupancy amount required to create the object is greater than or equal to a memory occupancy threshold, and a frequency of creating the object is greater than or equal to a frequency threshold.
5. The method according to claim 1, characterized in that After acquiring the object information of the object, the method further includes: Aggregation processing is performed on the object information according to an aggregation type, where the aggregation type includes one or more of a class name and a stack.
6. The method according to claim 1, characterized in that The client is connected to the server, and the method further comprises: The object information is sent to the server, where the object information is used to be displayed when the server queries the object information.
7. The method according to claim 6, characterized in that Before sending the object information to the server, the method further includes: Determine whether the object information meets an abnormality reporting condition.
8. The method according to any one of claims 1 to 7, characterized in that: The object information also includes one or more of the current scene of the object, the thread where the object is located, whether the object triggers garbage collection, the duration of garbage collection, sampling information of the object information, resource usage information of the client and business information of the client.
9. A device for processing object information, characterized in that: The device is applied to a client installed in a mobile terminal, and the device includes: a detection unit, configured to detect the object created by the client using a detection function, wherein the detection function is called based on a function symbol of the detection function, and the function symbol of the detection function is obtained by querying a system dynamic library of the mobile terminal; an acquiring unit, configured to acquire object information of the object if a created object is detected, the object information including a class name of the object and a memory usage of the object; The display unit is used to display the object information in response to obtaining a query instruction for the object information.
10. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium, characterized in that A computer program is stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.