CN113590088A - Method and device for automatically analyzing service condition of component and electronic equipment - Google Patents
Method and device for automatically analyzing service condition of component and electronic equipment Download PDFInfo
- Publication number
- CN113590088A CN113590088A CN202110823745.8A CN202110823745A CN113590088A CN 113590088 A CN113590088 A CN 113590088A CN 202110823745 A CN202110823745 A CN 202110823745A CN 113590088 A CN113590088 A CN 113590088A
- Authority
- CN
- China
- Prior art keywords
- component
- file
- pure
- files
- directory
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3438—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment monitoring of user actions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3452—Performance evaluation by statistical analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3604—Software analysis for verifying properties of programs
- G06F11/3608—Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Probability & Statistics with Applications (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the technical field of computers, in particular to a method, a device and electronic equipment for automatically analyzing the service condition of a component, which comprises the following steps: acquiring a component list and creating a component tree object; reading each component in the component list in sequence, and adding the component name of each component to the component tree object; performing recursive traversal on the target directory, and matching pure files corresponding to the components; storing the file address of the pure file under the corresponding component name in the component tree object to obtain the reference position and the reference times of each component; and displaying the use statistical results of the components through a display page. The method and the device can automatically count the use condition of the components, visually provide the number of times of being referred, the position of being referred and the like of each component, thereby quickly finding the needed components and reducing the repeated development of the components.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for automatically analyzing the service condition of a component and electronic equipment.
Background
With the increase of project scale and complexity and the necessity of modular development, the design not only increases reusability and improves work efficiency, but also reflects thinking and understanding of developers on business and product design to a certain extent, thereby achieving multiple purposes. However, with the popularization and deepening of componentization development, a series of problems are generated, for example, the more and more components lead to the problems that the rapid searching of the required components is difficult, the current use condition of each component is not clear, the component splitting granularity is different due to multi-user development, the reuse rate is low, the expansibility is poor and the like, the repeated development of the components is more and more, more redundant codes appear in the project, and therefore, the automatic statistics of the use condition of the components becomes necessary.
Disclosure of Invention
The invention provides a method and a device for automatically analyzing the service condition of a component and electronic equipment, which can automatically count the service condition of the component, quickly find a required component and reduce repeated development of the component.
An embodiment of the present specification provides a method for automatically analyzing a usage of a component, including:
acquiring a component list and creating a component tree object;
reading each component in the component list in sequence, and adding the component name of each component to the component tree object;
performing recursive traversal on the target directory, and matching pure files corresponding to the components;
storing the file address of the pure file under the corresponding component name in the component tree object to obtain the reference position and the reference times of each component;
and displaying the use statistical results of the components through a display page.
Preferably, the obtaining the component list includes:
positioning and storing directory addresses of all the components;
and reading each component according to the directory address degree to obtain a component list.
Preferably, the recursively traversing the target directory includes:
reading the target directory to obtain all files under the target directory;
and judging whether the file is a pure file or not, wherein the pure file comprises a pure text file, a pure picture file, a pure audio file and a pure video file.
Preferably, the determining whether the file is a pure file includes:
when the file is a pure file, reading the content of the pure file;
and when the file is a directory file, traversing the sub-directory files under the directory file, splicing the addresses of the sub-directory files, reading the sub-directory files through the addresses of the sub-directory files until the read sub-directory files are pure files, and reading the contents of the pure files.
Preferably, the matching to the pure files corresponding to the respective components includes:
judging whether the pure file has a corresponding component in the component list or not through regular matching;
when the corresponding component in the component list does not exist in the pure file, the component is not used;
when the corresponding component in the component list exists in the pure file, the file address of the pure file is recorded, and the number of times of reference of the corresponding component in the component list is increased.
Preferably, the obtaining of the reference position and the reference frequency of each component includes:
judging whether all the subdirectory files are verified or not;
when all the subdirectory files are not completely checked, continuing to carry out recursive traversal on the subdirectory files;
when all the subdirectory files are completely checked, whether each component is completely traversed or not is judged.
Preferably, the determining whether each component is completely traversed includes:
when each component is not completely traversed, continuing to carry out recursive traversal on the target directory;
and when all the components are completely traversed, obtaining the reference positions and the reference times of all the components through the component tree object.
An embodiment of the present specification further provides an apparatus for automatically analyzing a usage of a component, including:
the component tree object creating module is used for acquiring a component list and creating a component tree object;
the component tree object filling module is used for sequentially reading each component in the component list and adding the component name of each component to the component tree object;
the file matching module is used for performing recursive traversal on the target directory and matching pure files corresponding to the components;
the information statistics module is used for storing the file address of the pure file under the corresponding component name in the component tree object to obtain the reference position and the reference times of each component;
and the information display module is used for displaying the use statistical result of each component through a display page.
An electronic device, wherein the electronic device comprises:
a processor and a memory storing computer executable instructions that, when executed, cause the processor to perform the method of any of the above.
A computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method of any of the above.
According to the invention, the automatic statistics of the use condition of the components is realized in a file traversal mode, and the number of times of being referred and the position of being referred of each component are visually provided, so that the required components are quickly found, and the repeated development of the components is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a schematic diagram illustrating a method for automatically analyzing usage of a component according to an embodiment of the present disclosure;
FIG. 2 is a schematic structural diagram of an apparatus for automatically analyzing usage of a component according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure;
fig. 4 is a schematic diagram of a computer-readable medium provided in an embodiment of the present specification.
Detailed Description
Exemplary embodiments of the present invention will now be described more fully with reference to the accompanying drawings. The exemplary embodiments, however, may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these exemplary embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the invention to those skilled in the art. The same reference numerals denote the same or similar elements, components, or parts in the drawings, and thus their repetitive description will be omitted.
Features, structures, characteristics or other details described in a particular embodiment do not preclude the fact that the features, structures, characteristics or other details may be combined in a suitable manner in one or more other embodiments in accordance with the technical idea of the invention.
In describing particular embodiments, the present invention has been described with reference to features, structures, characteristics or other details that are within the purview of one skilled in the art to provide a thorough understanding of the embodiments. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific features, structures, characteristics, or other details.
The diagrams depicted in the figures are exemplary only, and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The term "and/or" and/or "includes all combinations of any one or more of the associated listed items.
Referring to fig. 1, a schematic diagram of a method for automatically analyzing a usage of a component according to an embodiment of the present disclosure includes:
s101: acquiring a component list and creating a component tree object;
in the preferred embodiment of the present invention, the components are stored uniformly, the directory address of the stored component is located when the project is started, all the components in the directory are read out through the directory address to obtain the component list, and a null object is created as the component tree object. The mode of creating the empty object as the component tree object facilitates the follow-up direct observation of the use condition of each component.
S102: reading each component in the component list in sequence, and adding the component name of each component to the component tree object;
in the preferred embodiment of the present invention, the first component is taken from the component list, then the component name is added as a key to the component tree object, then the subsequent recursive traversal of the target directory is performed, and then the second component is taken from the component list. And circulating the process until all the components finish the recursive traversal. By the method, the use information of each component can be directly obtained through the component tree object, the query is convenient,
s103: performing recursive traversal on the target directory, and matching pure files corresponding to the components;
in the preferred embodiment of the invention, the first component taken out from the component list is subjected to recursive traversal, all files in the target directory are traversed, and if the files do not exist, other components are traversed; when the file exists, judging whether the file is a directory file or not, carrying out the next operation according to the judgment result, finally reading the pure file, judging whether the file content of the pure file refers to the component or not according to the regular matching of the component to the file content of the pure file, recording the file address of the pure file at the moment if the file content of the pure file refers to the component, increasing the number of times of referring to the component once, and then circulating the process until all files in the target directory are completely traversed. By the method, data such as the referenced address and the referenced times of the component can be obtained, so that the project creator can reference the component conveniently and the repeated creation of the component is reduced.
S104: storing the file address of the pure file under the corresponding component name in the component tree object to obtain the reference position and the reference times of each component;
in the preferred embodiment of the invention, based on the information such as the file address of the pure file, the number of times of referencing the component and the like obtained in the last step, the information is filled under the corresponding component name in the component tree object, and the information such as the referencing position, the number of times of referencing the corresponding component and the like can be directly obtained by inquiring the component name, so that the required component can be quickly searched, the current use condition of each component can be clearly understood, the repeated development of the component is reduced, and more redundant codes in the project are reduced.
S105: and displaying the use statistical results of the components through a display page.
In the preferred embodiment of the invention, the data of the component tree object is read, visualized display is carried out, and the use condition of each component is visually known, wherein the use condition of each component comprises the referenced file address, the referenced times and the like.
Further, the obtaining the component list includes:
positioning and storing directory addresses of all the components;
and reading each component according to the directory address degree to obtain a component list.
Further, the recursively traversing the target directory includes:
reading the target directory to obtain all files under the target directory;
and judging whether the file is a pure file or not, wherein the pure file comprises a pure text file, a pure picture file, a pure audio file and a pure video file.
In the preferred embodiment of the present invention, all files in the target directory are read, traversal of all files is performed on each component, whether a pure file exists in each file or the built-in file of each file is determined, whether a reference of a corresponding component exists in each pure file can be known by reading the content of the pure file, if yes, the file addresses of the pure files are recorded, and the number of times that the corresponding component is referenced is increased once. The information such as the reference position, the reference times and the like of the corresponding component is obtained through the method, and the required component is quickly searched.
Further, the determining whether the file is a pure file includes:
when the file is a pure file, reading the content of the pure file;
and when the file is a directory file, traversing the sub-directory files under the directory file, splicing the addresses of the sub-directory files, reading the sub-directory files through the addresses of the sub-directory files until the read sub-directory files are pure files, and reading the contents of the pure files.
In the preferred embodiment of the invention, when the file is a pure file, the content of the pure file is directly read, and whether the pure file refers to the component or not is judged through the read content; when the file is a directory file, it is indicated that a subdirectory exists under the directory file, the subdirectory is further read, the file under the subdirectory is read according to the file address of the subdirectory by splicing the file addresses of the subdirectory, the process of reading the file under the subdirectory is circulated until the read file is a pure file, and then whether the pure file refers to the component is judged by reading the content of the pure file. By the method, the pure file is found, so that whether the pure file refers to the component or not can be judged conveniently, and the file address, the reference times and the like of the component are obtained.
Further, the matching to the pure files corresponding to the respective components includes:
judging whether the pure file has a corresponding component in the component list or not through regular matching;
when the corresponding component in the component list does not exist in the pure file, the component is not used;
when the corresponding component in the component list exists in the pure file, the file address of the pure file is recorded, and the number of times of reference of the corresponding component in the component list is increased.
In a preferred embodiment of the invention, a regular expression is arranged in a mode of introducing a first component according to a current item to match a current file, if matching fails, the corresponding component in the component list does not exist in the current file or a built-in file of the current file, and the component is not referred by the current file; if the matching is successful, the current file address is stored in the component tree object until all files in the target directory are traversed, so that all reference positions and times of the first component are obtained, and other residual components are traversed according to the mode, so that file addresses, referenced times and the like of all components are obtained. By the method, information such as the reference position and the reference times of the corresponding component is obtained, the required component is quickly searched, and repeated component construction processes are reduced.
Further, the obtaining of the reference position and the reference times of each component includes:
judging whether all the subdirectory files are verified or not;
when all the subdirectory files are not completely checked, continuing to carry out recursive traversal on the subdirectory files;
when all the subdirectory files are completely checked, whether each component is completely traversed or not is judged.
In the preferred embodiment of the invention, whether all the subdirectory files are verified or not is judged, and when all the subdirectory files are not completely verified, the regular matching process is completed until all the subdirectory files are subjected to recursive traversal; when all the subdirectory files are completely checked, whether each component is completely traversed or not is judged. By the method, the condition of using the components is guaranteed not to be counted wrongly when being counted.
Further, the determining whether each component is completely traversed includes:
when each component is not completely traversed, continuing to carry out recursive traversal on the target directory;
and when all the components are completely traversed, obtaining the reference positions and the reference times of all the components through the component tree object.
In the preferred embodiment of the present invention, the statistics of the usage of the component are not limited to the file address to which the component is referenced, the number of times the component is referenced, but may also be statistics of other information of the component.
In the preferred embodiment of the invention, the use condition of the components is automatically counted by traversing the file, the number of times of being referred to, the position of being referred to and the like of each component are provided based on the visualization of the component tree object, the needed components are quickly found, and the repeated development of the components is reduced.
In the preferred embodiment of the invention, step 1, locate the directory address of the storage assembly, read out all assemblies under the directory, get the assembly tabulation, newly build a empty object as the object of the component tree at the same time; step 2, determining a target directory of the reference condition of the component to be counted; step 3, taking out the first component from the component list, adding the component name as a key into the component tree object, and starting to perform recursive traversal on the target directory; step 4, firstly reading a target directory to obtain all file lists, judging the file lists one by one, splicing sub-directory addresses to continue reading from the inner layer if the current file is a directory, starting to read contents after the file is taken, judging whether the component is quoted in the current file or not by using a proper regular expression matching, if the matching is successful, storing the current file address into a component tree object until all files in the target directory are traversed, and thus obtaining all the quoted positions and times of the first component; step 5, reading a second component from the component list, executing the step 3, and so on until all components are traversed, wherein the component tree object contains the reference positions and times of all components; and 5, reading the data of the component tree object, and performing visual display.
Step 1 may refer to the pair "obtain component list" in the above embodiment, and create a component tree object; positioning and storing directory addresses of all the components; and reading each component according to the directory address degree to obtain a component list. "in step 2, reference may be made to the description of" reading the target directory to obtain all files under the target directory "in the above embodiment, and in step 3, reference may be made to the description of" sequentially reading each component in the component list, and adding the component name of each component to the component tree object in the above embodiment; "to describe, step 4 may refer to" reading the target directory in the above embodiment, and obtaining all files in the target directory; and judging whether the file is a pure file or not, wherein the pure file comprises a pure text file, a pure picture file, a pure audio file and a pure video file. When the file is a pure file, reading the content of the pure file; and when the file is a directory file, traversing the sub-directory files under the directory file, splicing the addresses of the sub-directory files, reading the sub-directory files through the addresses of the sub-directory files until the read sub-directory files are pure files, and reading the contents of the pure files. Judging whether the pure file has a corresponding component in the component list or not through regular matching; when the corresponding component in the component list does not exist in the pure file, the component is not used; when the corresponding component in the component list exists in the pure file, the file address of the pure file is recorded, and the number of times of reference of the corresponding component in the component list is increased. "step 5 may refer to the above embodiment for" showing the usage statistics of each component through the presentation page. "is described.
Fig. 2 is a schematic structural diagram of an apparatus for automatically analyzing a usage of a component according to an embodiment of the present disclosure, including:
a component tree object creation module 201, configured to obtain a component list and create a component tree object;
a component tree object filling module 202, configured to read each component in the component list in sequence, and add a component name of each component to the component tree object;
the file matching module 203 is used for performing recursive traversal on the target directory and matching pure files corresponding to the components;
the information statistics module 204 is configured to store the file address of the pure file under the corresponding component name in the component tree object to obtain a reference position and reference times of each component;
and the information presentation module 205 is configured to present the usage statistics of each component through a presentation page.
Further, the component tree object creating module 201 includes a component list obtaining unit, configured to locate a directory address for storing each component; and reading each component according to the directory address degree to obtain a component list.
Further, the file matching module 203 includes a file determining unit, configured to read the target directory to obtain all files in the target directory; and judging whether the file is a pure file or not, wherein the pure file comprises a pure text file, a pure picture file, a pure audio file and a pure video file. When the file is a pure file, reading the content of the pure file; and when the file is a directory file, traversing the sub-directory files under the directory file, splicing the addresses of the sub-directory files, reading the sub-directory files through the addresses of the sub-directory files until the read sub-directory files are pure files, and reading the contents of the pure files. Judging whether the pure file has a corresponding component in the component list or not through regular matching; when the corresponding component in the component list does not exist in the pure file, the component is not used; when the corresponding component in the component list exists in the pure file, the file address of the pure file is recorded, and the number of times of reference of the corresponding component in the component list is increased.
Further, the information statistics module 204 includes an information statistics unit, configured to determine whether all the subdirectory files have been verified; when all the subdirectory files are not completely checked, continuing to carry out recursive traversal on the subdirectory files; when all the subdirectory files are completely checked, whether each component is completely traversed or not is judged. When each component is not completely traversed, continuing to carry out recursive traversal on the target directory; and when all the components are completely traversed, obtaining the reference positions and the reference times of all the components through the component tree object.
The functions of the apparatus in the embodiment of the present invention have been described in the above method embodiments, so that reference may be made to the related descriptions in the foregoing embodiments for details that are not described in the present embodiment, and further details are not described herein.
Based on the same inventive concept, the embodiment of the specification further provides the electronic equipment.
In the following, embodiments of the electronic device of the present invention are described, which may be regarded as specific physical implementations for the above-described embodiments of the method and apparatus of the present invention. Details described in the embodiments of the electronic device of the invention should be considered supplementary to the embodiments of the method or apparatus described above; for details which are not disclosed in embodiments of the electronic device of the invention, reference may be made to the above-described embodiments of the method or the apparatus.
Fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification. An electronic device 300 according to this embodiment of the invention is described below with reference to fig. 3. The electronic device 300 shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 3, electronic device 300 is embodied in the form of a general purpose computing device. The components of electronic device 300 may include, but are not limited to: at least one processing unit 310, at least one memory unit 320, a bus 330 connecting different device components (including the memory unit 320 and the processing unit 310), a display unit 340, and the like.
Wherein the storage unit stores program code executable by the processing unit 310 to cause the processing unit 310 to perform the steps according to various exemplary embodiments of the present invention described in the above-mentioned processing method section of the present specification. For example, the processing unit 310 may perform the steps as shown in fig. 1.
The storage unit 320 may include readable media in the form of volatile storage units, such as a random access memory unit (RAM)3201 and/or a cache storage unit 3202, and may further include a read only memory unit (ROM) 3203.
The storage unit 320 may also include a program/utility 3204 having a set (at least one) of program modules 3205, such program modules 3205 including, but not limited to: an operating device, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The electronic device 300 may also communicate with one or more external devices 400 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 300, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 300 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 350. Also, the electronic device 300 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 360. Network adapter 360 may communicate with other modules of electronic device 300 via bus 330. It should be appreciated that although not shown in FIG. 3, other hardware and/or software modules may be used in conjunction with electronic device 300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID devices, tape drives, and data backup storage devices, to name a few.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments of the present invention described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a computing device (which can be a personal computer, a server, or a network device, etc.) execute the above-mentioned method according to the present invention. The computer program, when executed by a data processing apparatus, enables the computer readable medium to implement the above-described method of the invention, namely: such as the method shown in fig. 1.
Fig. 4 is a schematic diagram of a computer-readable medium provided in an embodiment of the present disclosure.
A computer program implementing the method shown in fig. 1 may be stored on one or more computer readable media. The computer readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor device, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution apparatus, device, or apparatus. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
In summary, the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functionality of some or all of the components in embodiments in accordance with the invention may be implemented in practice using a general purpose data processing device such as a microprocessor or a Digital Signal Processor (DSP). The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
While the foregoing embodiments have described the objects, aspects and advantages of the present invention in further detail, it should be understood that the present invention is not inherently related to any particular computer, virtual machine or electronic device, and various general-purpose machines may be used to implement the present invention. The invention is not to be considered as limited to the specific embodiments thereof, but is to be understood as being modified in all respects, all changes and equivalents that come within the spirit and scope of the invention.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A method for automatically analyzing usage of a component, comprising:
acquiring a component list and creating a component tree object;
reading each component in the component list in sequence, and adding the component name of each component to the component tree object;
performing recursive traversal on the target directory, and matching pure files corresponding to the components;
storing the file address of the pure file under the corresponding component name in the component tree object to obtain the reference position and the reference times of each component;
and displaying the use statistical results of the components through a display page.
2. The method of automatically analyzing component usage according to claim 1, wherein the obtaining a list of components comprises:
positioning and storing directory addresses of all the components;
and reading each component according to the directory address degree to obtain a component list.
3. The method of automatically analyzing component usage according to any of claims 1-2, wherein the recursively traversing the target directory comprises:
reading the target directory to obtain all files under the target directory;
and judging whether the file is a pure file or not, wherein the pure file comprises a pure text file, a pure picture file, a pure audio file and a pure video file.
4. A method for automatically analyzing usage of a component according to any of claims 1-3, wherein said determining whether the document is a plain document comprises:
when the file is a pure file, reading the content of the pure file;
and when the file is a directory file, traversing the sub-directory files under the directory file, splicing the addresses of the sub-directory files, reading the sub-directory files through the addresses of the sub-directory files until the read sub-directory files are pure files, and reading the contents of the pure files.
5. The method of automatically analyzing component usage according to any of claims 1-4, wherein the matching to the plain document corresponding to each component comprises:
judging whether the pure file has a corresponding component in the component list or not through regular matching;
when the corresponding component in the component list does not exist in the pure file, the component is not used;
when the corresponding component in the component list exists in the pure file, the file address of the pure file is recorded, and the number of times of reference of the corresponding component in the component list is increased.
6. The method for automatically analyzing the use condition of the components according to any one of claims 1-5, wherein the obtaining of the reference position and the reference times of each component comprises the following steps:
judging whether all the subdirectory files are verified or not;
when all the subdirectory files are not completely checked, continuing to carry out recursive traversal on the subdirectory files;
when all the subdirectory files are completely checked, whether each component is completely traversed or not is judged.
7. The method of any of claims 1-6, wherein said determining whether each component is completely traversed comprises:
when each component is not completely traversed, continuing to carry out recursive traversal on the target directory;
and when all the components are completely traversed, obtaining the reference positions and the reference times of all the components through the component tree object.
8. An apparatus for automatically analyzing usage of a component, comprising:
the component tree object creating module is used for acquiring a component list and creating a component tree object;
the component tree object filling module is used for sequentially reading each component in the component list and adding the component name of each component to the component tree object;
the file matching module is used for performing recursive traversal on the target directory and matching pure files corresponding to the components;
the information statistics module is used for storing the file address of the pure file under the corresponding component name in the component tree object to obtain the reference position and the reference times of each component;
and the information display module is used for displaying the use statistical result of each component through a display page.
9. An electronic device, wherein the electronic device comprises:
a processor and a memory storing computer-executable instructions that, when executed, cause the processor to perform the method of any of claims 1-7.
10. A computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110823745.8A CN113590088B (en) | 2021-07-21 | 2021-07-21 | Method and device for automatically analyzing use condition of component and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110823745.8A CN113590088B (en) | 2021-07-21 | 2021-07-21 | Method and device for automatically analyzing use condition of component and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113590088A true CN113590088A (en) | 2021-11-02 |
CN113590088B CN113590088B (en) | 2023-07-21 |
Family
ID=78248667
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110823745.8A Active CN113590088B (en) | 2021-07-21 | 2021-07-21 | Method and device for automatically analyzing use condition of component and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113590088B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114661299A (en) * | 2022-04-11 | 2022-06-24 | 平安资产管理有限责任公司 | Component statistical method, tool, device, equipment and medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108733551A (en) * | 2017-04-13 | 2018-11-02 | 中兴通讯股份有限公司 | Control visiting method and device, analysis system |
US20200387439A1 (en) * | 2019-06-06 | 2020-12-10 | International Business Machines Corporation | Intercepting and recording calls to a module in real-time |
CN112241394A (en) * | 2020-10-15 | 2021-01-19 | 浪潮商用机器有限公司 | Index node IO statistical method, tool, equipment and storage medium |
CN112328557A (en) * | 2020-10-19 | 2021-02-05 | 中国建设银行股份有限公司 | File quantity statistical method, device, equipment and storage medium |
CN112364107A (en) * | 2020-11-10 | 2021-02-12 | 平安普惠企业管理有限公司 | System analysis visualization method and device, electronic equipment and computer readable storage medium |
CN113064814A (en) * | 2021-03-09 | 2021-07-02 | 青岛海尔科技有限公司 | Processing method and device of component reference data, storage medium and electronic device |
-
2021
- 2021-07-21 CN CN202110823745.8A patent/CN113590088B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108733551A (en) * | 2017-04-13 | 2018-11-02 | 中兴通讯股份有限公司 | Control visiting method and device, analysis system |
US20200387439A1 (en) * | 2019-06-06 | 2020-12-10 | International Business Machines Corporation | Intercepting and recording calls to a module in real-time |
CN112241394A (en) * | 2020-10-15 | 2021-01-19 | 浪潮商用机器有限公司 | Index node IO statistical method, tool, equipment and storage medium |
CN112328557A (en) * | 2020-10-19 | 2021-02-05 | 中国建设银行股份有限公司 | File quantity statistical method, device, equipment and storage medium |
CN112364107A (en) * | 2020-11-10 | 2021-02-12 | 平安普惠企业管理有限公司 | System analysis visualization method and device, electronic equipment and computer readable storage medium |
CN113064814A (en) * | 2021-03-09 | 2021-07-02 | 青岛海尔科技有限公司 | Processing method and device of component reference data, storage medium and electronic device |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114661299A (en) * | 2022-04-11 | 2022-06-24 | 平安资产管理有限责任公司 | Component statistical method, tool, device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN113590088B (en) | 2023-07-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110502227B (en) | Code complement method and device, storage medium and electronic equipment | |
US20230114540A1 (en) | Checking source code validity at time of code update | |
CN111736840A (en) | Compiling method and running method of applet, storage medium and electronic equipment | |
CN111240689A (en) | Application program construction method, device, equipment and storage medium | |
CN110058861B (en) | Source code processing method and device, storage medium and electronic equipment | |
CN110347573B (en) | Application program analysis method, device, electronic equipment and computer readable medium | |
CN113051514A (en) | Element positioning method and device, electronic equipment and storage medium | |
CN115599386A (en) | Code generation method, device, equipment and storage medium | |
CN113760306A (en) | Method and device for installing software, electronic equipment and storage medium | |
CN113590088B (en) | Method and device for automatically analyzing use condition of component and electronic equipment | |
CN110196952B (en) | Program code search processing method, device, equipment and storage medium | |
CN110362404B (en) | SQL-based resource allocation method and device and electronic equipment | |
US20230088670A1 (en) | Reverse compiler | |
US20150178075A1 (en) | Enhancing understandability of code using code clones | |
CN116561161A (en) | Data backtracking method, system and storage medium based on mysql database behaviors | |
CN113179183B (en) | Service switch state control device and method | |
CN102591859B (en) | Method and relevant device for reusing industrial standard formatted files | |
CN114817803A (en) | Page skipping method and device and electronic equipment | |
CN113157699B (en) | Business data auditing method and device and electronic equipment | |
US6854109B2 (en) | Tool for converting .MAP file formats | |
CN114090514A (en) | Log retrieval method and device for distributed system | |
CN112650839A (en) | Retrieval information optimization method and device | |
CN109697167B (en) | Method and system for managing test variables, electronic device and storage medium | |
CN113343649A (en) | File annotation method and device, storage medium and computing equipment | |
US10866993B2 (en) | Managing online help information in a data center |
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 |