CN111522677A - Method and device for recording start information based on embedded system - Google Patents
Method and device for recording start information based on embedded system Download PDFInfo
- Publication number
- CN111522677A CN111522677A CN202010258573.XA CN202010258573A CN111522677A CN 111522677 A CN111522677 A CN 111522677A CN 202010258573 A CN202010258573 A CN 202010258573A CN 111522677 A CN111522677 A CN 111522677A
- Authority
- CN
- China
- Prior art keywords
- module
- preset
- embedded system
- countdown timer
- service
- 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.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0751—Error or fault detection not based on redundancy
- G06F11/0754—Error or fault detection not based on redundancy by exceeding limits
- G06F11/0757—Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
-
- 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/3466—Performance evaluation by tracing or monitoring
- G06F11/3476—Data logging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Quality & Reliability (AREA)
- Computer Hardware Design (AREA)
- Retry When Errors Occur (AREA)
Abstract
The invention discloses a method and a device for recording start information based on an embedded system, wherein the method comprises the following steps: loading a preset module after starting the embedded system; calling the preset module to create a first callback function, a countdown timer and a second callback function corresponding to the countdown timer at a creation process entrance; calling the first callback function in the process of sequentially loading each preset service module to record the loading information of the corresponding service module in the preset module, and monitoring whether the countdown timer is cleared or not; if the countdown timer is cleared and all the service modules are not loaded, calling the second callback function to output the loading information of the service modules recorded by the preset module so as to position the abnormal starting position of the embedded system. The scheme can provide a basis for rapidly positioning the abnormal starting position of the embedded system, and further improve the positioning efficiency.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for recording startup information based on an embedded system.
Background
With the complexity of the embedded system being improved, more and more business modules are provided, and sometimes code logic errors occur in some business modules, which may cause the embedded system to be unable to start normally.
Because the embedded system cannot be started normally and cannot enter an interactive command line, the embedded system loads all the service modules in series at present, cannot record the starting information of all the service modules, cannot position the abnormal position based on the starting information of all the service modules, and can only position the abnormal starting position of the embedded system by repeatedly cutting the service modules. Therefore, a method for recording start-up information based on an embedded system is needed.
Disclosure of Invention
The embodiment of the invention provides a method and a device for recording starting information based on an embedded system, which are used for recording the starting information of the embedded system.
According to an embodiment of the present invention, a method for recording start information based on an embedded system is provided, which is applied to the embedded system, and includes:
loading a preset module after starting the embedded system;
calling the preset module to create a first callback function at a process creation entrance, starting a countdown timer and creating a second callback function corresponding to the countdown timer;
calling the first callback function in the process of sequentially loading each preset service module to record the loading information of the corresponding service module in the preset module, and monitoring whether the countdown timer is cleared or not;
if the countdown timer is cleared and all the service modules are not loaded, calling the second callback function to output the loading information of the service modules recorded by the preset module so as to position the abnormal starting position of the embedded system.
Optionally, the method further includes:
if the countdown timer is not cleared when all the service modules are monitored to be loaded, clearing the loading information of the service modules recorded by the preset module;
closing the countdown timer.
Optionally, after the second callback function is called to output the loading information of the service module recorded by the preset module, the method further includes:
and storing the loading information of the service module recorded by the preset module in preset storage equipment.
Optionally, after the loading information of the service module recorded by the preset module is stored in the preset storage device, the method further includes:
and restarting the embedded system.
According to an embodiment of the present invention, there is also provided a startup information recording apparatus based on an embedded system, applied to the embedded system, including:
the loading module is used for loading a preset module after the embedded system is started;
the first calling module is used for calling the preset module to create a first callback function at a process entrance, start a countdown timer and create a second callback function corresponding to the countdown timer;
the second calling module is used for calling the first callback function in the process of sequentially loading each preset service module, recording the loading information of the corresponding service module in the preset module, and monitoring whether the countdown timer is cleared or not;
and the third calling module is used for calling the second callback function to output the loading information of the service module recorded by the preset module if the countdown timer is cleared and all the service modules are not loaded completely, so as to position the abnormal starting position of the embedded system.
Optionally, the method further includes:
the clearing module is used for clearing the loading information of the service modules recorded by the preset module if the countdown timer is not cleared when all the service modules are monitored to be loaded;
a shutdown module to shut down the countdown timer.
Optionally, the system further includes a saving module, configured to:
and after the third calling module calls the second callback function to output the loading information of the service module recorded by the preset module, storing the loading information of the service module recorded by the preset module in a preset storage device.
Optionally, the system further includes a restart module, configured to:
and restarting the embedded system after the storage module stores the loading information of the business module recorded by the preset module in preset storage equipment.
According to the embodiment of the invention, the electronic equipment comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing the above method steps when executing the program stored in the memory.
According to an embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program, which when executed by a processor, performs the above-mentioned method steps.
The invention has the following beneficial effects:
the embodiment of the invention provides a method and a device for recording starting information based on an embedded system, wherein a preset module is loaded after the embedded system is started; calling the preset module to create a first callback function at a process creation entrance, starting a countdown timer and creating a second callback function corresponding to the countdown timer; calling the first callback function in the process of sequentially loading each preset service module to record the loading information of the corresponding service module in the preset module, and monitoring whether the countdown timer is cleared or not; if the countdown timer is cleared and all the service modules are not loaded, calling the second callback function to output the loading information of the service modules recorded by the preset module so as to position the abnormal starting position of the embedded system. According to the scheme, the loaded information of the loaded service modules can be recorded in the preset module, if the pre-established countdown timer is reset, all the service modules cannot be loaded, the embedded system is abnormal, the loaded information of the service modules recorded by the preset module can be output and used for positioning the abnormal starting position of the embedded system, and the preset module records the loaded information of the loaded service modules, so that a basis can be provided for quickly positioning the abnormal starting position of the embedded system, and the positioning efficiency is improved.
Drawings
FIG. 1 is a flowchart of a method for starting information recording based on an embedded system according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an apparatus for starting recording of information based on an embedded system according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device shown in the present application.
Detailed Description
In order to record the start information of the embedded system, an embodiment of the present invention provides a start information recording method based on the embedded system, which is applied to the embedded system, and the flow of the method is shown in fig. 1, and the execution steps are as follows:
s11: and loading the preset module after the embedded system is started.
The code block can be written in advance to obtain the preset module, and the preset module is loaded firstly after the embedded system is started.
S12: and calling a preset module to create a first callback function at a creation process inlet, start a countdown timer and create a second callback function corresponding to the countdown timer.
Usually, when an embedded system loads a service module, a corresponding process is created at a process creation entrance, so that a preset module can be called to create a first callback function at the process creation entrance, so that the first callback function can be called when the process creation entrance is created; meanwhile, a preset module can be called to start the countdown timer at the process entrance and create a second callback function corresponding to the countdown timer. The duration of the countdown timer can be set according to actual needs.
S13: and calling a first callback function in the process of sequentially loading each preset service module to record the loading information of the corresponding service module in the preset module, and monitoring whether the countdown timer is cleared or not.
Generally, a plurality of service modules are loaded in an embedded system, and the service modules have a preset loading sequence, so that the service modules can be loaded in sequence, a process corresponding to the service module is created at a process creation entrance in the process of loading the service modules, at this time, a first callback function can be called to record loading information of the corresponding service module in a preset module, and the loading information of the service modules can include, but is not limited to, a process name, creation time, a process identifier, stack information of the process, and the like; at the same time, the countdown timer is also monitored for clearing.
S14: if the countdown timer is cleared and all the service modules are not loaded, calling a second callback function to output the loading information of the service modules recorded by the preset module so as to position the abnormal starting position of the embedded system.
According to whether the countdown timer is cleared and whether all the service modules are loaded, whether the second callback function is called to output the loading information of the service modules recorded by the preset module or not can be determined, and the method specifically comprises the following steps: if the countdown timer is monitored to be zero, all the service modules are not loaded, the embedded system is abnormal, and at the moment, a second callback function can be called to output the loading information of the service modules recorded by the preset module so as to position the abnormal starting position of the embedded system; if the countdown timer is not cleared when it is monitored that all the service modules are loaded, it is indicated that the embedded system has already loaded all the service modules, that is, the embedded system has been started normally, and the loading information of the service modules recorded by the preset module does not need to be retained, the loading information of the service modules recorded by the preset module can be cleared, and the countdown timer can be closed.
According to the scheme, the loaded information of the loaded service modules can be recorded in the preset module, if the pre-established countdown timer is reset, all the service modules cannot be loaded, the embedded system is abnormal, the loaded information of the service modules recorded by the preset module can be output and used for positioning the abnormal starting position of the embedded system, and the preset module records the loaded information of the loaded service modules, so that a basis can be provided for quickly positioning the abnormal starting position of the embedded system, and the positioning efficiency is improved.
In an optional implementation manner, after the calling the second callback function in S14 to output the loading information of the service module recorded by the preset module, the method further includes:
and storing the loading information of the service module recorded by the preset module in the preset storage device.
Sometimes, the loading information of the service module recorded by the preset module may not be normally output, and in order to ensure the security of the loading information of the service module recorded by the preset module and not lose the loading information, the loading information of the service module recorded by the preset module may be stored in the preset storage device.
The preset storage device can be set according to actual needs.
An optional implementation manner, after saving the loading information of the service module recorded by the preset module in the preset storage device, further includes:
and restarting the embedded system.
And storing the loading information of the service module recorded by the preset module in the preset storage device, which indicates that the embedded system is abnormal at the moment, so that the embedded system needs to be restarted, so that the embedded system can perform corresponding work after being normally started.
Based on the same inventive concept, an embodiment of the present invention provides a startup information recording device based on an embedded system, which can be disposed in the embedded system, and has a structure as shown in fig. 2, including:
the loading module 21 is used for loading the preset module after the embedded system is started;
the first calling module 22 is used for calling the preset module to create a first callback function, a countdown timer and a second callback function corresponding to the countdown timer at the creation process entrance;
the second calling module 23 is configured to call the first callback function in the process of sequentially loading the preset service modules, record loading information of the corresponding service module in the preset module, and monitor whether the countdown timer is cleared;
and a third calling module 24, configured to, if it is monitored that the countdown timer is cleared and all the service modules are not completely loaded, call the second callback function to output the loading information of the service module recorded by the preset module, so as to locate the start abnormal position of the embedded system.
According to the scheme, the loaded information of the loaded service modules can be recorded in the preset module, if the pre-established countdown timer is reset, all the service modules cannot be loaded, the embedded system is abnormal, the loaded information of the service modules recorded by the preset module can be output and used for positioning the abnormal starting position of the embedded system, and the preset module records the loaded information of the loaded service modules, so that a basis can be provided for quickly positioning the abnormal starting position of the embedded system, and the positioning efficiency is improved.
Optionally, the method further includes:
the clearing module is used for clearing the loading information of the service modules recorded by the preset module if the countdown timer is not cleared when all the service modules are monitored to be loaded;
and the closing module is used for closing the countdown timer.
Optionally, the system further includes a saving module, configured to:
and after the third calling module calls the second callback function to output the loading information of the service module recorded by the preset module, storing the loading information of the service module recorded by the preset module in the preset storage device.
Optionally, the system further includes a restart module, configured to:
and restarting the embedded system after the storage module stores the loading information of the business module recorded by the preset module in the preset storage device.
An electronic device is further provided in the embodiment of the present application, please refer to fig. 3, which includes a processor 310, a communication interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 complete communication with each other through the communication bus 340.
A memory 330 for storing a computer program;
the processor 310 is configured to implement the method for recording start-up information based on an embedded system according to any of the above embodiments when executing the program stored in the memory 330.
The communication interface 320 is used for communication between the above-described electronic device and other devices.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
According to the scheme, the loaded information of the loaded service modules can be recorded in the preset module, if the pre-established countdown timer is reset, all the service modules cannot be loaded, the embedded system is abnormal, the loaded information of the service modules recorded by the preset module can be output and used for positioning the abnormal starting position of the embedded system, and the preset module records the loaded information of the loaded service modules, so that a basis can be provided for quickly positioning the abnormal starting position of the embedded system, and the positioning efficiency is improved.
Accordingly, an embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer is caused to execute any of the embedded system-based startup information recording methods described in the foregoing embodiments.
According to the scheme, the loaded information of the loaded service modules can be recorded in the preset module, if the pre-established countdown timer is reset, all the service modules cannot be loaded, the embedded system is abnormal, the loaded information of the service modules recorded by the preset module can be output and used for positioning the abnormal starting position of the embedded system, and the preset module records the loaded information of the loaded service modules, so that a basis can be provided for quickly positioning the abnormal starting position of the embedded system, and the positioning efficiency is improved.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. 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 apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, 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 apparatus 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 apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While alternative embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following appended claims be interpreted as including alternative embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.
Claims (10)
1. A startup information recording method based on an embedded system is applied to the embedded system and is characterized by comprising the following steps:
loading a preset module after starting the embedded system;
calling the preset module to create a first callback function at a process creation entrance, starting a countdown timer and creating a second callback function corresponding to the countdown timer;
calling the first callback function in the process of sequentially loading each preset service module to record the loading information of the corresponding service module in the preset module, and monitoring whether the countdown timer is cleared or not;
if the countdown timer is cleared and all the service modules are not loaded, calling the second callback function to output the loading information of the service modules recorded by the preset module so as to position the abnormal starting position of the embedded system.
2. The method of claim 1, further comprising:
if the countdown timer is not cleared when all the service modules are monitored to be loaded, clearing the loading information of the service modules recorded by the preset module;
closing the countdown timer.
3. The method according to claim 1 or 2, wherein after calling the second callback function to output the loading information of the service module recorded by the preset module, the method further comprises:
and storing the loading information of the service module recorded by the preset module in preset storage equipment.
4. The method of claim 3, wherein after storing the loading information of the service module recorded by the preset module in a preset storage device, the method further comprises:
and restarting the embedded system.
5. A startup information recording device based on an embedded system is applied to the embedded system, and is characterized by comprising:
the loading module is used for loading a preset module after the embedded system is started;
the first calling module is used for calling the preset module to create a first callback function at a process entrance, start a countdown timer and create a second callback function corresponding to the countdown timer;
the second calling module is used for calling the first callback function in the process of sequentially loading each preset service module, recording the loading information of the corresponding service module in the preset module, and monitoring whether the countdown timer is cleared or not;
and the third calling module is used for calling the second callback function to output the loading information of the service module recorded by the preset module if the countdown timer is cleared and all the service modules are not loaded completely, so as to position the abnormal starting position of the embedded system.
6. The method of claim 5, further comprising:
the clearing module is used for clearing the loading information of the service modules recorded by the preset module if the countdown timer is not cleared when all the service modules are monitored to be loaded;
a shutdown module to shut down the countdown timer.
7. The method of claim 5 or 6, further comprising a save module to:
and after the third calling module calls the second callback function to output the loading information of the service module recorded by the preset module, storing the loading information of the service module recorded by the preset module in a preset storage device.
8. The method of claim 7, further comprising a restart module to:
and restarting the embedded system after the storage module stores the loading information of the business module recorded by the preset module in preset storage equipment.
9. An electronic device, characterized in that the electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-4 when executing a program stored on a memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010258573.XA CN111522677A (en) | 2020-04-03 | 2020-04-03 | Method and device for recording start information based on embedded system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010258573.XA CN111522677A (en) | 2020-04-03 | 2020-04-03 | Method and device for recording start information based on embedded system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111522677A true CN111522677A (en) | 2020-08-11 |
Family
ID=71902512
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010258573.XA Withdrawn CN111522677A (en) | 2020-04-03 | 2020-04-03 | Method and device for recording start information based on embedded system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111522677A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115292140A (en) * | 2022-09-01 | 2022-11-04 | 摩尔线程智能科技(北京)有限责任公司 | Method, apparatus and computer readable medium for monitoring system startup |
-
2020
- 2020-04-03 CN CN202010258573.XA patent/CN111522677A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115292140A (en) * | 2022-09-01 | 2022-11-04 | 摩尔线程智能科技(北京)有限责任公司 | Method, apparatus and computer readable medium for monitoring system startup |
CN115292140B (en) * | 2022-09-01 | 2023-08-15 | 摩尔线程智能科技(北京)有限责任公司 | Method, apparatus and computer readable medium for monitoring system start-up |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110650036A (en) | Alarm processing method and device and electronic equipment | |
CN109086079B (en) | Mounting management method and device for storage equipment | |
CN111782360A (en) | Distributed task scheduling method and device | |
CN110225078B (en) | Application service updating method, system and terminal equipment | |
CN110515795B (en) | Big data component monitoring method and device and electronic equipment | |
WO2018019242A1 (en) | Self-recovery method and self-recovery system for web server | |
WO2018001048A1 (en) | Multi-process monitoring method, apparatus and service system | |
CN108897646B (en) | Switching method of BIOS (basic input output System) chips and substrate management controller | |
CN110647463B (en) | Method and device for restoring test breakpoint and electronic equipment | |
CN111522677A (en) | Method and device for recording start information based on embedded system | |
WO2019140738A1 (en) | Method for avoiding excess return visits, and electronic apparatus and computer-readable storage medium | |
CN111371642B (en) | Network card fault detection method, device, equipment and storage medium | |
CN110968456B (en) | Method and device for processing fault disk in distributed storage system | |
CN109783210B (en) | Multitasking method, apparatus, computer device and storage medium | |
CN107517472B (en) | Method for protecting state of base station and base station | |
CN113127245B (en) | Method, system and device for processing system management interrupt | |
CN109634796A (en) | A kind of method for diagnosing faults of computer, apparatus and system | |
CN111045832B (en) | Method and system for monitoring software endless loop or blocking | |
CN112650538A (en) | Starting method and device of network equipment | |
CN108958827B (en) | Method and system for processing program upgrading fault | |
CN117375088B (en) | SFC system continuous dragging energy storage unit method and device, SFC system and storage medium | |
CN112148463B (en) | Business process control method and device | |
CN109614116B (en) | Installation method and device of embedded system | |
CN110677268B (en) | NFV automatic arrangement scheduling method, device and system | |
CN112241283B (en) | Software upgrading method, device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20200811 |