CN110780882A - Code file processing method, device and system, electronic equipment and storage medium - Google Patents

Code file processing method, device and system, electronic equipment and storage medium Download PDF

Info

Publication number
CN110780882A
CN110780882A CN201911089898.3A CN201911089898A CN110780882A CN 110780882 A CN110780882 A CN 110780882A CN 201911089898 A CN201911089898 A CN 201911089898A CN 110780882 A CN110780882 A CN 110780882A
Authority
CN
China
Prior art keywords
code file
calling
preset
code
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911089898.3A
Other languages
Chinese (zh)
Other versions
CN110780882B (en
Inventor
赵宇杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201911089898.3A priority Critical patent/CN110780882B/en
Publication of CN110780882A publication Critical patent/CN110780882A/en
Application granted granted Critical
Publication of CN110780882B publication Critical patent/CN110780882B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4434Reducing the memory space required by the program code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3072Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting

Abstract

The embodiment of the application provides a method, a device, a system, electronic equipment and a storage medium for processing a code file, wherein the method comprises the steps of responding to the calling of a target code file in the running process of a client, and storing a calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code; and when the preset trigger condition is met, sending the calling list to a server side so that the server side can calculate the code calling frequency corresponding to the target code file. By the aid of the method and the device, optimization processing of code calling frequency statistics is achieved, a use log of a code file does not need to be added manually, and efficiency of code using frequency statistics is improved.

Description

Code file processing method, device and system, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a system, an electronic device, and a storage medium for processing a code file.
Background
With the development of science and technology, software applications on terminals are more and more, such as video entertainment, social communication, text editing and the like, and the method relates to the aspects of people's life and brings more and more convenience to users.
In the development process of mobile application, while the application functions are continuously increased, the application codes are also increased sharply, so that the storage space occupied by the application is increased, and the maintenance and test costs are also increased, therefore, some code files with low use frequency in the application can be deleted.
In the prior art, when a developer suspects that the use frequency of a certain code file is low, a log can be manually added in the code file and reported to a server for statistics, but when the developer does not suspects, the log cannot be added, the use frequency of the code file cannot be obtained, the developer needs to manually add the log, and the statistical efficiency is low.
Disclosure of Invention
In view of the above, it is proposed to provide a method and an apparatus, a system, an electronic device, a storage medium for processing a code file that overcome or at least partially solve the above problems, comprising:
a processing method of a code file is applied to a client and comprises the following steps:
in the running process of the client, responding to the calling of the target code file, and storing a calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code;
and when the preset trigger condition is met, sending the calling list to a server side so that the server side can calculate the code calling frequency corresponding to the target code file.
Optionally, the preset bytecode is configured to store a call record of the target code file in a preset call list.
Optionally, the storing the call record of the object code file in a preset call list includes:
acquiring attribute information corresponding to the target code file;
and storing the attribute information in a preset calling list.
Optionally, the attribute information includes: the class identifier of the class to which the file belongs, or the class identifier of the class to which the file belongs and the file package identifier of the file package to which the file belongs.
Optionally, the preset trigger condition includes: when the client is restarted.
Optionally, the method further comprises:
acquiring version information corresponding to the client;
storing the version information in the call list.
Optionally, the client is an android client.
A processing method of a code file is applied to a server and comprises the following steps:
receiving a call list sent by one or more clients; the one or more clients are used for responding to the calling of the target code file in the running process, storing a calling record of the target code file in a preset calling list and sending the calling list to the server when the calling record accords with a preset triggering condition; the target code file is a code file added with a preset byte code;
and calculating the code calling frequency corresponding to the target code file according to the calling list.
Optionally, the preset bytecode is configured to store a call record of the target code file in a preset call list.
Optionally, the calculating, according to the call list, a code call frequency corresponding to the target code file includes:
determining the number of first lists corresponding to the call lists meeting the preset screening conditions;
determining the number of second lists corresponding to the call lists containing the call records in the call lists meeting the preset screening conditions;
and generating a code calling frequency corresponding to the target code file by adopting the first list quantity and the second list quantity.
Optionally, the calling list further stores version information corresponding to the client, and the screening condition includes: with the same version information.
A processing method of a code file is applied to a programming end and comprises the following steps:
determining an object code file in the process of compiling the code;
adding a preset byte code aiming at the target code file; the preset bytecode is used for responding to the calling of the target code file in the running process of the client and storing a calling record of the target code file in a preset calling list; the calling list is used for the server side to calculate the code calling frequency corresponding to the target code file;
and after the code compiling is finished, issuing by the client.
Optionally, in the process of compiling the code, determining the object code file includes:
compiling the source code file into a plurality of byte code files in the process of compiling the codes;
traversing file paths corresponding to the byte code files;
and determining a target byte code file of which the file path contains preset information, and taking a source code file corresponding to the target byte code file as a target code file.
Optionally, the preset information includes: a preset file package identifier, or a preset file package identifier and a preset class identifier.
A processing method of code files is applied to an interactive system, the interactive system comprises a programming end, a client end and a server end, and the method comprises the following steps:
the programming end determines an object code file in the process of code compiling, adds a preset byte code aiming at the object code file, and issues a client after the code compiling is finished;
the client side responds to the calling of the target code file in the running process, stores a calling record of the target code file in a preset calling list, and sends the calling list to the server side when the calling record accords with a preset triggering condition;
and the server receives a calling list sent by one or more clients and calculates the code calling frequency corresponding to the target code file according to the calling list.
A processing device of a code file, which is applied to a client, comprises:
the calling record storage module is used for responding to the calling of the target code file in the running process of the client and storing the calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code;
and the calling list sending module is used for sending the calling list to a server side when a preset trigger condition is met so that the server side can calculate the code calling frequency corresponding to the target code file.
A processing device of a code file is applied to a server and comprises:
the calling list receiving module is used for receiving a calling list sent by one or more clients; the one or more clients are used for responding to the calling of the target code file in the running process, storing a calling record of the target code file in a preset calling list and sending the calling list to the server when the calling record accords with a preset triggering condition; the target code file is a code file added with a preset byte code;
and the code calling frequency calculation module is used for calculating the code calling frequency corresponding to the target code file according to the calling list.
A processing device of a code file, which is applied to a programming end, comprises:
the object code file module is used for determining an object code file in the process of compiling codes;
the preset byte code adding module is used for adding preset byte codes aiming at the target code file; the preset bytecode is used for responding to the calling of the target code file in the running process of the client and storing a calling record of the target code file in a preset calling list; the calling list is used for the server side to calculate the code calling frequency corresponding to the target code file;
and the client issuing module is used for issuing the client after the code compiling is finished.
A system for processing code files, the system comprising a programming side, a client side, and a server side, comprising:
the programming end is used for determining an object code file in the process of code compiling, adding a preset byte code aiming at the object code file, and issuing a client after the code compiling is finished;
the client is used for responding to the calling of the target code file in the running process, storing a calling record of the target code file in a preset calling list, and sending the calling list to the server when the preset triggering condition is met;
and the server is used for receiving the call lists sent by one or more clients and calculating the code call frequency corresponding to the target code file according to the call lists.
An electronic device comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, the computer program, when executed by the processor, implementing the steps of the method of processing a code file as described above.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of processing a code file as described above.
The embodiment of the application has the following advantages:
in the embodiment of the application, in the running process of the client, responding to the calling of the target code file, and generating a calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code, and when a preset trigger condition is met, the calling list is sent to the server side so that the server side can calculate the code calling frequency corresponding to the target code file, optimization processing of code calling frequency statistics is achieved, a using log of the code file does not need to be added manually, and the efficiency of code using frequency statistics is improved.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings needed to be used in the description of the present application will be briefly introduced below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive labor.
FIG. 1 is a flowchart illustrating steps of a method for processing a code file according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating steps of another method for processing a code file according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating steps of another method for processing a code file according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating steps of another method for processing a code file according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a device for processing a code file according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of another apparatus for processing a code file according to an embodiment of the present application;
FIG. 7 is a schematic structural diagram of another apparatus for processing a code file according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a system for processing a code file according to an embodiment of the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, a flowchart illustrating steps of a method for processing a code file according to an embodiment of the present application is shown, where the method may be applied to a client, where the client may be an android client, and may communicate with a server, and specifically includes the following steps:
step 101, in the running process of the client, responding to the calling of the target code file, and generating a calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code;
the code file may be a file recording a client running code, and multiple application functions of the client may be implemented by one or more code files.
In a specific implementation, a call list may be preset in the client to record a call record of the target code file. In the running process of the client, the client can monitor whether a call request for an application function is received, wherein the call request can be actively triggered by user operation, or can be generated after receiving information sent by a server or other clients.
After receiving the call request, the client may call the code file to implement a function corresponding to the call request, and when the called file is the target code file, in response to the call of the target code file, the client may generate a call record of the target code file in a call list.
For example, in the client, the code related to the "personal data interface" is recorded in an object code file named "UserInfoActivity.
For another example, the code for sending the chat information is recorded in an object code file of "IMController.
In an embodiment of the present application, the call record may be attribute information corresponding to the target code file, and then step 101 may include the following sub-steps:
acquiring attribute information corresponding to the target code file; and storing the attribute information in a preset calling list.
In a specific implementation, due to the fact that the preset byte codes are set, the client can obtain the attribute information corresponding to the target code file, and then the attribute information is stored in the calling list.
In an embodiment, since each code file corresponds to a class, the client may directly obtain the class identifier of the class to which the target code file belongs, and the attribute information may include: class identification of the class to which it belongs.
In another embodiment, although the class identifier in the same package of files is unique, but the class identifiers of different packages of files may be the same, the client may obtain the class identifier of the class to which the object code file belongs and the package identifier of the package of files to which the object code file belongs at the same time, and the attribute information may include: class identification of the belonged class and file package identification of the belonged file package.
And 102, when a preset trigger condition is met, sending the calling list to a server side so that the server side can calculate the code calling frequency corresponding to the target code file.
After the call record is generated, the client may send the call list to the server when detecting that the preset trigger condition is met, and after receiving the call list, the server may calculate the code call frequency in the target code file, and calculate a specific processing procedure of the code call frequency, which will be described in detail below.
In practical applications, the preset trigger conditions may include: when the client is restarted, because the client can have a plurality of target code files to be called in the running process and generate a calling record in the calling list for a plurality of times, in order to reduce the data sending times of the client, the client can send the calling list generated in the last running process to the server when the client is restarted.
In an embodiment of the present application, the method may further include the steps of:
acquiring version information corresponding to the client; storing the version information in the call list.
In specific implementation, version information corresponding to the client can be acquired, so that the version information can be stored in the call list, and the server can analyze the clients of the same version.
In the embodiment of the application, in the running process of the client, responding to the calling of the target code file, and generating a calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code, and when a preset trigger condition is met, the calling list is sent to the server side so that the server side can calculate the code calling frequency corresponding to the target code file, optimization processing of code calling frequency statistics is achieved, a using log of the code file does not need to be added manually, and the efficiency of code using frequency statistics is improved.
Referring to fig. 2, a flowchart illustrating steps of another method for processing a code file according to an embodiment of the present application is shown, which may be applied to a server, and specifically includes the following steps:
step 201, receiving a call list sent by one or more clients, wherein the one or more clients are used for responding to the call of a target code file in the running process, storing a call record of the target code file in a preset call list, and sending the call list to the server when a preset trigger condition is met; the target code file is a code file added with a preset byte code;
the code file may be a file for recording an operation code of the client, and multiple application functions of the client may be realized by using one or more code files, and in the process of compiling the code, a preset bytecode may be added to the code file, where the preset bytecode is used to store a call record of the target code file in a preset call list, and the process is described in detail below and is not described herein again.
In a specific implementation, a call list may be preset in a client, in an operation process of the client, when an object code file is called, the client may generate a call record including an object code file identifier in the call list, or may also record the number of times that the object code file is called, and when the client is restarted, the call record generated during the last operation may be sent to a server, so that the server may receive the call list sent by one or more clients.
Step 202, calculating a code calling frequency corresponding to the target code file according to the calling list.
After receiving the call list, the server may obtain a call record from the call list, and calculate the code call frequency of the target code file using the call record.
In an embodiment of the present application, step 202 may include the following sub-steps:
determining the number of first lists corresponding to the call lists meeting the preset screening conditions; determining the number of second lists corresponding to the call lists containing the call records in the call lists meeting the preset screening conditions; and generating a code calling frequency corresponding to the target code file by adopting the first list quantity and the second list quantity.
As an example, the invocation list may further store version information corresponding to the client, and the filtering condition may include: with the same version information.
Because a plurality of call lists are received, the screening conditions can be preset, so that the call lists meeting the screening conditions can be determined, and the number of the corresponding first lists is counted, namely the number of the call lists which can be sent for the client side with the same version information is counted.
Correspondingly, the call list containing the call records of the target code file can be determined in the call list meeting the preset screening condition, and the number of the corresponding second lists is counted.
After the first list quantity and the second list quantity are determined, the code calling frequency corresponding to the target code file can be generated by adopting the first list quantity and the second list quantity.
For example, the client a and the client B are clients of the same version, and a call record of an object code file "imcontroller. The client side B uploads a call list, so that call records of target code files 'UserInfoActivity.java' and 'IMController.java' are recorded, the client side A and the client side B upload a call list respectively, the server side can count to obtain that the total number (namely the number of first lists) of the call lists uploaded by the client sides of the same version is 2, and can determine that the number (namely the number of second lists) of the call records containing the target code files 'UserInfoActivity.java' is 1 and the number (namely the number of second lists) of the call records containing the target code files 'IMController.java' is 2, and then the number of the second lists is divided by the number of the first lists to obtain the code call frequency.
In the embodiment of the application, the calling list sent by one or more clients is received, then, the code calling frequency corresponding to the target code file can be calculated according to the calling list, the one or more clients are used for responding to the calling of the target code file in the running process, storing the calling record of the target code file in the preset calling list, and sending the calling list to the server when the preset triggering condition is met, the target code file is the code file added with the preset byte code, so that the optimization processing of code calling frequency statistics is realized, the use log of the code file does not need to be manually added, and the efficiency of counting the code using frequency is improved.
Referring to fig. 3, a flowchart illustrating steps of another method for processing a code file according to an embodiment of the present application is shown, which may be applied to a programming end, and specifically includes the following steps:
step 301, determining a target code file in the process of code compiling;
in the process of compiling the code, an object code file of the code calling frequency statistics to be performed can be determined from a source code file, and the source code file can be a Java code file.
In an embodiment of the present application, step 301 may include the following sub-steps:
compiling the source code file into a plurality of byte code files in the process of compiling the codes; traversing file paths corresponding to the byte code files; and determining a target byte code file of which the file path contains preset information, and taking a source code file corresponding to the target byte code file as a target code file.
In a specific implementation, the source code file may be compiled into a plurality of bytecode files, then file paths corresponding to the plurality of bytecode files are traversed, a target bytecode file whose file path includes preset information may be determined, and the source code file corresponding to the target bytecode file is used as the target code file.
In one example, the preset information may include: a preset file package identifier, or a preset file package identifier and a preset class identifier.
When a software application is developed, a plurality of file packages can be preset to store a source code file, one of the file packages can be used as a main file package, and the package name of the main file package is the main package name of the application. Under each file package, several source code files may be stored, the number may be several to several tens of thousands. In each source code file, a class may be stored, and the identification of the class may be matched with the identification of the source code file storing the class, taking the source code file "SID 6144event. The class identifier may be unique within the same package, and may be the same in different packages.
In practical application, a user may input a preset file package identifier at a programming end to count the code calling frequency of all code files in a file package corresponding to the preset file package identifier, or input a preset file package identifier and a preset class identifier to count the code calling frequency of a code file corresponding to a class identifier preset in a file package corresponding to the preset file package identifier.
Due to characteristics of Java programming language, a file path of a source code file may include a package identifier corresponding to a package in which the source code file is located and a class identifier of a class to which the source code file belongs, for example, a package in which a source code file a.java belongs to the package identifier com.net.cc, the file path of the source code file may include "/com/net/cc/a.java", and when the source code file is compiled into a bytecode file, the file path of the bytecode file may include "/com/net/cc/a.class".
Based on this, the programming end can traverse the file path of each bytecode file, and when the file path includes a preset file package identifier, or a preset file package identifier and a preset class identifier, the bytecode file can be determined as a target bytecode file, and then the target bytecode file is determined.
In an example, after the object code file is determined, an identifier of the object code file, which may be a class identifier of a class to which the object code file belongs, or a class identifier of the class to which the object code file belongs and a file package identifier of a file package to which the object code file belongs, may be recorded, a statistical list is generated and sent to the server to record a code file whose calling frequency needs to be counted subsequently, and the client may generate the statistical list for the compiling at this time in each compiling process.
Step 302, adding a preset byte code aiming at the target code file; the preset bytecode is used for responding to the calling of the target code file in the running process of the client and storing a calling record of the target code file in a preset calling list; the calling list is used for the server side to calculate the code calling frequency corresponding to the target code file;
after the target code file is determined, a preset bytecode can be added to the target code file, specifically, a instrumentation technology can be adopted, the preset bytecode is added to the bytecode file corresponding to the target code file, and developers do not need to modify the code file manually one by one to add a use log.
Step 303, after the code compilation is completed, the client-side issuing is performed.
After the preset byte codes are added, the programming end can continue to compile the byte code file to obtain an executable file, and then the executable file can be issued by the client.
In the embodiment of the application, the target code file is determined in the process of code compiling, the preset byte code is added for the target code file, the preset byte code can be used for responding to calling of the target code file in the running process of a client, the calling record of the target code file is stored in a preset calling list, the calling list can be used for a server to calculate the code calling frequency corresponding to the target code file, then the client can be issued after the code compiling is completed, the optimization processing of code calling frequency statistics is realized, logs do not need to be manually added in the code file, and the efficiency of code calling frequency statistics is improved.
Referring to fig. 4, a flowchart illustrating steps of another method for processing a code file according to an embodiment of the present application is shown, where the method may be applied to an interactive system, where the interactive system may include a programming end, a client end, and a server end, and specifically may include the following steps:
step 401, the programming end determines an object code file in the process of code compiling, adds a preset byte code to the object code file, and issues a client after the code compiling is completed;
step 402, in the running process, the client responds to the calling of the target code file, stores a calling record of the target code file in a preset calling list, and sends the calling list to the server when the calling record meets a preset triggering condition;
step 403, the server receives a call list sent by one or more clients, and calculates a code call frequency corresponding to the target code file according to the call list.
In the embodiment of the application, a target code file is determined in the process of code compiling through a programming end, preset byte codes are added for the target code file, the client issues the code after the code compiling is completed, the client responds to the calling of the target code file in the running process, the calling record of the target code file is stored in a preset calling list, the calling list is sent to a server when the preset triggering condition is met, the server receives the calling lists sent by one or more clients, and the code calling frequency corresponding to the target code file is calculated according to the calling list, so that the optimization processing of code calling frequency statistics is realized, logs do not need to be manually added in the code file, and the efficiency of code calling frequency statistics is improved.
In order to enable those skilled in the art to better understand the above steps, the embodiments of the present invention are illustrated by the following examples, but it should be understood that the embodiments of the present invention are not limited thereto.
For example, in the process of compiling the client, the "userinfoactivity. java", "loginaactivity. java", and the "imcontroller. java" are determined as target code files, and a statistical list including the identifiers "userinfoactivity. java", "loginaactivity. java", and "imcontroller. java" is generated and sent to the server.
After the client is restarted, the server receives an invocation list a uploaded by the client A, wherein an identifier 'IMController. java' is stored in the invocation list a so as to record that the client A loads a class in a target code file 'IMController. java' in the last operation process, and meanwhile, the client B also uploads an invocation list B, wherein the invocation list B comprises identifiers 'UserInfoActivity. java' and 'IMController. java'.
After the call list a and the call list b are obtained, the server side can determine target code files corresponding to the calling frequencies of the codes to be counted, namely 'UserInfoActivity.java', 'LoginActivity.java' and 'IMController.java', through the statistical list, and then respectively determine the number of the call lists (namely, the number of the second lists) containing the identifiers 'UserInfoActivity.java', 'LoginActivity.java' and 'IMController.java' to be 1, 0 and 2.
Since the total number of the received call lists (i.e., the number of the first list) is 2, the server may determine that the code call frequency of "userinfoactivity. java" is 1/2, i.e., 50%; java "loginactivity. code invocation frequency is 0/2, i.e. 0%; java "has a code call frequency of 2/2, i.e. 100%.
As another example, during client compilation, "a.java", "b.java", and "c.java" are determined to be target bytecode files.
After the client is issued to a user, the client A runs for three times within a preset time (the client is not restarted after running for the third time), and uploads an invocation list containing identifications 'A.java', 'B.java' and 'C.java' generated by the first runtime during the second running, and uploads an invocation list containing identifications 'A.java' and 'B.java' generated by the second runtime during the third running; the client B runs twice within a preset time (the client is not restarted after the second run), and uploads a call list generated in the first run during the second run, where the call list includes an identifier "a.java".
In a preset time, the total number of call lists (i.e., the first list number) received by the service degree is 3, the number of call lists (i.e., the second list number) including the identifiers "a.java", "b.java", and "c.java" is 3, 2, and 1, respectively, and it can be calculated that the code call frequency of "a.java" is 3/3, i.e., 100%, "b.java" is 2/3, i.e., 66.7%, "c.java" is 1/3, i.e., 33.3%.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the embodiments. Further, those skilled in the art will also appreciate that the embodiments described in the specification are presently preferred and that no particular act is required of the embodiments of the application.
Referring to fig. 5, a schematic structural diagram of a processing apparatus for a code file according to an embodiment of the present application is shown, which may be applied to a client, and specifically includes the following modules:
a call record storage module 501, configured to respond to a call to an object code file in an operation process of the client, and store a call record of the object code file in a preset call list; the target code file is a code file added with a preset byte code;
the calling list sending module 502 is configured to send the calling list to a server when a preset trigger condition is met, so that the server calculates a code calling frequency corresponding to the target code file.
In an embodiment of the present application, the preset bytecode is configured to store a call record of the object code file in a preset call list.
In an embodiment of the present application, the call record storage module 501 includes:
the attribute information acquisition submodule is used for acquiring attribute information corresponding to the target code file;
and the attribute information storage submodule is used for storing the attribute information in a preset calling list.
In an embodiment of the present application, the attribute information includes: the class identifier of the class to which the file belongs, or the class identifier of the class to which the file belongs and the file package identifier of the file package to which the file belongs.
In an embodiment of the present application, the preset trigger condition includes: when the client is restarted.
In an embodiment of the present application, the apparatus further includes:
the version information module is used for acquiring the version information corresponding to the client;
and the version information storage module is used for storing the version information in the calling list.
In an embodiment of the application, the client is an android client.
Referring to fig. 6, a schematic structural diagram of a processing apparatus for a code file according to an embodiment of the present application is shown, which may be applied to a server, and specifically includes the following modules:
a call list receiving module 601, configured to receive a call list sent by one or more clients; the one or more clients are used for responding to the calling of the target code file in the running process, storing a calling record of the target code file in a preset calling list and sending the calling list to the server when the calling record accords with a preset triggering condition; the target code file is a code file added with a preset byte code;
and a code calling frequency calculating module 602, configured to calculate, according to the calling list, a code calling frequency corresponding to the target code file.
In an embodiment of the present application, the preset bytecode is configured to store a call record of the object code file in a preset call list.
In an embodiment of the present application, the code call frequency calculation module 602 includes:
the first list quantity determining submodule is used for determining the quantity of the first list corresponding to the calling list which meets the preset screening condition;
a second list quantity determining submodule, configured to determine, in the call list meeting the preset screening condition, a second list quantity corresponding to the call list including the call record;
and the code calling frequency generation submodule is used for generating the code calling frequency corresponding to the target code file by adopting the first list quantity and the second list quantity.
In an embodiment of the present application, the calling list further stores version information corresponding to the client, and the filtering condition includes: with the same version information.
Referring to fig. 7, a schematic structural diagram of a processing apparatus for a code file according to an embodiment of the present application is shown, which may be applied to a programming end, and specifically includes the following modules:
an object code file determining module 701, configured to determine an object code file in a process of performing code compilation;
a preset bytecode adding module 702, configured to add a preset bytecode to the target code file; the preset bytecode is used for responding to the calling of the target code file in the running process of the client and storing a calling record of the target code file in a preset calling list; the calling list is used for the server side to calculate the code calling frequency corresponding to the target code file;
and the client publishing module 703 is configured to publish the client after the code compilation is completed.
In an embodiment of the present application, the object code file determining module 701 includes:
the byte code file compiling submodule is used for compiling the source code file into a plurality of byte code files in the process of code compiling;
the file path traversing submodule is used for traversing file paths corresponding to the byte code files;
and the target byte code file determining submodule is used for determining a target byte code file of which the file path contains preset information and taking a source code file corresponding to the target byte code file as a target code file.
In an embodiment of the present application, the preset information includes: a preset file package identifier, or a preset file package identifier and a preset class identifier.
Referring to fig. 8, a schematic structural diagram of a system for processing a code file provided in an embodiment of the present application is shown, where the system includes a programming end 801, a client 802, and a server 803.
The programming end 801 is configured to determine an object code file in a code compiling process, add a preset bytecode to the object code file, and issue a client after the code compiling is completed;
the client 802 is configured to respond to a call to a target code file in an operation process, store a call record of the target code file in a preset call list, and send the call list to the server when a preset trigger condition is met;
the server 803 is configured to receive a call list sent by one or more clients, and calculate a code call frequency corresponding to the target code file according to the call list.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
An embodiment of the present application also provides an electronic device, which may include a processor, a memory, and a computer program stored on the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the method for processing the code file are implemented.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when being executed by a processor, the computer program implements the steps of the method for processing the code file.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method and apparatus for processing the provided code file, the system, the electronic device, and the storage medium are introduced in detail, and a specific example is applied in the description to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (21)

1. A method for processing a code file, comprising: applied to a client, comprising:
in the running process of the client, responding to the calling of the target code file, and storing a calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code;
and when the preset trigger condition is met, sending the calling list to a server side so that the server side can calculate the code calling frequency corresponding to the target code file.
2. The method of claim 1, wherein: the preset byte code is used for storing a calling record of the target code file to a preset calling list.
3. The method of claim 1 or 2, wherein: the storing of the call record of the object code file in a preset call list comprises:
acquiring attribute information corresponding to the target code file;
and storing the attribute information in a preset calling list.
4. The method of claim 3, wherein: the attribute information includes: the class identifier of the class to which the file belongs, or the class identifier of the class to which the file belongs and the file package identifier of the file package to which the file belongs.
5. The method of claim 1, wherein: the preset trigger conditions include: when the client is restarted.
6. The method of claim 1, wherein: the method further comprises the following steps:
acquiring version information corresponding to the client;
storing the version information in the call list.
7. The method of claim 1, wherein: the client is an android client.
8. A processing method of a code file is applied to a server and comprises the following steps:
receiving a call list sent by one or more clients; the one or more clients are used for responding to the calling of the target code file in the running process, storing a calling record of the target code file in a preset calling list and sending the calling list to the server when the calling record accords with a preset triggering condition; the target code file is a code file added with a preset byte code;
and calculating the code calling frequency corresponding to the target code file according to the calling list.
9. The method of claim 8, wherein: the preset byte code is used for storing a calling record of the target code file to a preset calling list.
10. The method of claim 8 or 9, wherein: the calculating the code calling frequency corresponding to the target code file according to the calling list comprises:
determining the number of first lists corresponding to the call lists meeting the preset screening conditions;
determining the number of second lists corresponding to the call lists containing the call records in the call lists meeting the preset screening conditions;
and generating a code calling frequency corresponding to the target code file by adopting the first list quantity and the second list quantity.
11. The method of claim 10, wherein: the calling list also stores version information corresponding to the client, and the screening condition comprises that: with the same version information.
12. A method for processing a code file, comprising: applied to the programming end, comprising:
determining an object code file in the process of compiling the code;
adding a preset byte code aiming at the target code file; the preset bytecode is used for responding to the calling of the target code file in the running process of the client and storing a calling record of the target code file in a preset calling list; the calling list is used for the server side to calculate the code calling frequency corresponding to the target code file;
and after the code compiling is finished, issuing by the client.
13. The method of claim 12, wherein: in the process of compiling the code, determining the object code file comprises:
compiling the source code file into a plurality of byte code files in the process of compiling the codes;
traversing file paths corresponding to the byte code files;
and determining a target byte code file of which the file path contains preset information, and taking a source code file corresponding to the target byte code file as a target code file.
14. The method of claim 13, wherein: the preset information includes: a preset file package identifier, or a preset file package identifier and a preset class identifier.
15. A method for processing a code file, comprising: the method is applied to an interactive system, the interactive system comprises a programming end, a client and a server, and the method comprises the following steps:
the programming end determines an object code file in the process of code compiling, adds a preset byte code aiming at the object code file, and issues a client after the code compiling is finished;
the client side responds to the calling of the target code file in the running process, stores a calling record of the target code file in a preset calling list, and sends the calling list to the server side when the calling record accords with a preset triggering condition;
and the server receives a calling list sent by one or more clients and calculates the code calling frequency corresponding to the target code file according to the calling list.
16. A code file processing apparatus, characterized by: applied to a client, comprising:
the calling record storage module is used for responding to the calling of the target code file in the running process of the client and storing the calling record of the target code file in a preset calling list; the target code file is a code file added with a preset byte code;
and the calling list sending module is used for sending the calling list to a server side when a preset trigger condition is met so that the server side can calculate the code calling frequency corresponding to the target code file.
17. A processing device of a code file is applied to a server and comprises:
the calling list receiving module is used for receiving a calling list sent by one or more clients; the one or more clients are used for responding to the calling of the target code file in the running process, storing a calling record of the target code file in a preset calling list and sending the calling list to the server when the calling record accords with a preset triggering condition; the target code file is a code file added with a preset byte code;
and the code calling frequency calculation module is used for calculating the code calling frequency corresponding to the target code file according to the calling list.
18. A code file processing apparatus, characterized by: applied to the programming end, comprising:
the object code file module is used for determining an object code file in the process of compiling codes;
the preset byte code adding module is used for adding preset byte codes aiming at the target code file; the preset bytecode is used for responding to the calling of the target code file in the running process of the client and storing a calling record of the target code file in a preset calling list; the calling list is used for the server side to calculate the code calling frequency corresponding to the target code file;
and the client issuing module is used for issuing the client after the code compiling is finished.
19. A system for processing a code file, comprising: the system comprises a programming end, a client and a server, and comprises:
the programming end is used for determining an object code file in the process of code compiling, adding a preset byte code aiming at the object code file, and issuing a client after the code compiling is finished;
the client is used for responding to the calling of the target code file in the running process, storing a calling record of the target code file in a preset calling list, and sending the calling list to the server when the preset triggering condition is met;
and the server is used for receiving the call lists sent by one or more clients and calculating the code call frequency corresponding to the target code file according to the call lists.
20. An electronic device, comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, the computer program, when executed by the processor, implementing the steps of the method of processing a code file according to any one of claims 1 to 15.
21. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of processing a code file according to any one of claims 1 to 15.
CN201911089898.3A 2019-11-08 2019-11-08 Method, device, system, electronic equipment and storage medium for processing code file Active CN110780882B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911089898.3A CN110780882B (en) 2019-11-08 2019-11-08 Method, device, system, electronic equipment and storage medium for processing code file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911089898.3A CN110780882B (en) 2019-11-08 2019-11-08 Method, device, system, electronic equipment and storage medium for processing code file

Publications (2)

Publication Number Publication Date
CN110780882A true CN110780882A (en) 2020-02-11
CN110780882B CN110780882B (en) 2023-12-01

Family

ID=69390232

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911089898.3A Active CN110780882B (en) 2019-11-08 2019-11-08 Method, device, system, electronic equipment and storage medium for processing code file

Country Status (1)

Country Link
CN (1) CN110780882B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111580824A (en) * 2020-03-30 2020-08-25 北京达佳互联信息技术有限公司 Program optimization method, device and storage medium
CN111782220A (en) * 2020-08-18 2020-10-16 网易(杭州)网络有限公司 File detection method and device
CN112667245A (en) * 2021-01-15 2021-04-16 腾讯音乐娱乐科技(深圳)有限公司 Code processing method and device, electronic equipment and storage medium
CN113760237A (en) * 2021-10-22 2021-12-07 深圳市元征科技股份有限公司 Compiling address updating method and device, terminal equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6631515B1 (en) * 1998-09-24 2003-10-07 International Business Machines Corporation Method and apparatus to reduce code size and runtime in a Java environment
CN107341033A (en) * 2017-06-30 2017-11-10 百度在线网络技术(北京)有限公司 A kind of data statistical approach, device, electronic equipment and storage medium
CN109753286A (en) * 2018-12-28 2019-05-14 四川新网银行股份有限公司 A method of the code method based on functional label counts its call number

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6631515B1 (en) * 1998-09-24 2003-10-07 International Business Machines Corporation Method and apparatus to reduce code size and runtime in a Java environment
CN107341033A (en) * 2017-06-30 2017-11-10 百度在线网络技术(北京)有限公司 A kind of data statistical approach, device, electronic equipment and storage medium
CN109753286A (en) * 2018-12-28 2019-05-14 四川新网银行股份有限公司 A method of the code method based on functional label counts its call number

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111580824A (en) * 2020-03-30 2020-08-25 北京达佳互联信息技术有限公司 Program optimization method, device and storage medium
CN111782220A (en) * 2020-08-18 2020-10-16 网易(杭州)网络有限公司 File detection method and device
CN112667245A (en) * 2021-01-15 2021-04-16 腾讯音乐娱乐科技(深圳)有限公司 Code processing method and device, electronic equipment and storage medium
CN113760237A (en) * 2021-10-22 2021-12-07 深圳市元征科技股份有限公司 Compiling address updating method and device, terminal equipment and readable storage medium

Also Published As

Publication number Publication date
CN110780882B (en) 2023-12-01

Similar Documents

Publication Publication Date Title
CN110780882B (en) Method, device, system, electronic equipment and storage medium for processing code file
CN108319547B (en) Test case generation method, device and system
RU2488166C2 (en) Service-oriented conveyor-based architecture
US8037458B2 (en) Method and system for providing a common structure for trace data
US9203905B1 (en) Sessionization of visitor activity
CN110941528B (en) Log buried point setting method, device and system based on fault
US11556456B2 (en) Telemetry system extension
US20170109379A1 (en) Telemetry definition system
CN111078551A (en) Full link testing method, device and system and computer readable storage medium
CN114490375A (en) Method, device and equipment for testing performance of application program and storage medium
CN107526636B (en) Resource identification method and device
CN110941632A (en) Database auditing method, device and equipment
CN110008086B (en) Log generation method and device and client
CN110134583B (en) Software testing and data processing method and device
CN110333984B (en) Interface abnormality detection method, device, server and system
CN112540808B (en) Recording method of program behavior hierarchy call relationship and related equipment
CN112306471A (en) Task scheduling method and device
CN112131085A (en) Method, system and device for recording and playing back Internet business process
CN108966041B (en) Audio and video playing point burying method, device, equipment and computer readable storage medium
US20110213663A1 (en) Service intelligence module program product
CN109542775B (en) Test script generation and execution method and device
CN109587198B (en) Image-text information pushing method and device
CN115455059A (en) Method, device and related medium for analyzing user behavior based on underlying data
CN114281549A (en) Data processing method and device
CN112559348B (en) Test analysis method, system, equipment and medium based on jacoco

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant