In a kind of embedded device, intelligence exports the method and system of Debugging messageTechnical field
The present invention relates to the debugging technique field of embedded device, particularly relate to intelligence in a kind of embedded device and export the method and system of Debugging message.
Background technology
In recent years, along with the develop rapidly of internet, the quantity of the embedded device in access network presents explosive growth.Be not only quantity sharp increase, network topology also becomes increasingly complex, and function integrated in equipment is also more and more.In this increasingly sophisticated network application environment, once equipment goes wrong, the first investigation means are exactly certainly check Debugging message.
At present, the output mechanism of the Debugging message of existing producer all, after equipment receives Debugging message, will be passed through IO (InputandOutput, input and output) interface immediately and export.Although this output mechanism is simple, efficient, finding in actual use, still there is following defect in it:
When Debugging message is exported by I/O interface, if now just have user just at operating equipment, the output of Debugging message will be mixed in together with the I/O operation of user, can have a strong impact on user operation like this, makes the non-constant of Consumer's Experience.Such as, so a kind of scene, maintainer finds that certain equipment breaks down, and in order to investigate trouble spot, is just done as follows: the debug switch opening modules A, opens the debug switch of module B, and modules A prepares output 2 Debugging message, is aaaaa, AAA respectively; Module B prepares output 3 Debugging message, is bbbb, BBBB, b-b-b respectively; And now, maintainer prepares again simultaneously input command capable " showversion " (checking device version information), then when maintainer just inputs " showver " time, the output of possible modules A and module B simultaneously, probably just there is the phenomenon that information confusion is interted in the display now on device end, as " showveraabbbbaaaBBAAABBb-b-b ".So both have impact on the input of maintainer, cause maintainer to need to re-enter order, the output of A, B module simultaneously also mixes, and cannot check completely.
Cause the reason of the problems referred to above to be, the output of Debugging message is uncontrollable, and multiple task exports together, and mixes with the I/O operation of user; This is also the impact by tasks of embedded system scheduling, and multiple task operates same I/O interface simultaneously, is just easy to the phenomenon occurring that this information confusion is interted.
Summary of the invention
The object of the invention is the deficiency in order to overcome above-mentioned background technology, intelligence in a kind of embedded device is provided to export the method and system of Debugging message, can intelligence between user operation and Debugging message export, find equilibrium point, preferential answering user operation, and do not lose Debugging message, avoid the phenomenon that information confusion is interted, significantly improve user's impression and equipment easy applied performance.
For reaching above object, the invention provides intelligence in a kind of embedded device and exporting the method for Debugging message, comprising the following steps:
A, in the office terminal of embedded device, set up a buffer area for multistage pipeline information; In the office terminal of embedded device preset the probe interval cycle and free time threshold value, by the initialization time started when processing point be designated as time point value T1, proceed to step B;
B, within each probe interval cycle, when user does not have I/O operation, judge that the difference between current time and time point value T1 is greater than free time threshold value, and in buffer area, have Debugging message to be output, then Debugging message is outputted to I/O interface, proceed to step C;
C, judge whether to need to enter next probe interval cycle, if so, then return step B, wait for and enter the next probe interval cycle; Otherwise, terminate.
On the basis of technique scheme, in step B, within each probe interval cycle, when user has I/O operation, then perform the I/O operation of user, and record current time, using current time as new time point value T1, proceed to step C.
On the basis of technique scheme, in step B, when user does not have I/O operation, further comprising the steps of: the difference judging between current time and up-to-date time point value T1 be not more than free time threshold value or buffer area in there is no Debugging message to be output, then proceed to step C.
On the basis of technique scheme, the size of buffer area described in steps A, carries out real-time configuration modification according to user's request, during amendment, utilizes reserved configuration interface to carry out real-time configuration modification.
On the basis of technique scheme, in steps A, when buffer area remaining space is not enough, the Debugging message before new Debugging message is covered, or directly abandon new Debugging message.
On the basis of technique scheme, the cycle of probe interval described in steps A is preset as 0.5 second ~ 2 seconds.
On the basis of technique scheme, after presetting probe interval cycle and free time threshold value described in steps A in the office terminal of embedded device, by reserved parameter/configuration interface to the probe interval cycle, free time threshold value carry out real-time configuration modification.
On the basis of technique scheme, when Debugging message being outputted to I/O interface described in step B, the number of the Debugging message exported first exports according to the number of default value, and then according to exterior arrangement and instruction, the number to the Debugging message exported adjusts in real time.
On the basis of technique scheme, after Debugging message being outputted to I/O interface described in step B, this Debugging message exported is deleted from buffer area.
The present invention also provides a kind of and exports the system of Debugging message based on intelligence in the embedded device of said method, comprises initial setup module, Debugging message output module and detection judge module;
Described initial setup module is used for: in the office terminal of embedded device, set up a buffer area for multistage pipeline information; Preset in the office terminal of embedded device the probe interval cycle and free time threshold value, the initialization time started when processing point is designated as time point value T1, sends output processing signal to Debugging message output module;
Described Debugging message output module is used for: after receiving output processing signal, within each probe interval cycle, when user does not have I/O operation, judge that the difference between current time and time point value T1 is greater than free time threshold value, and in buffer area, have Debugging message to be output, then Debugging message is outputted to I/O interface, send to detection judge module and judge signal;
Described Debugging message output module is used for: receive after judging signal, and judging whether needs to enter next probe interval cycle, if so, sends output processing signal to Debugging message output module, waits for and enters the next probe interval cycle; Otherwise, quit work.
Compared with prior art, advantage of the present invention is as follows:
(1) in the present invention, set up a buffer area for multistage pipeline information in the office terminal of embedded device, all Debugging message directly do not output to I/O interface, but are first buffered in described buffer area; And, judge that current device is in idle condition or busy state by the free time threshold value arranged, only have when equipment is when being in idle condition, just export the Debugging message in buffer area, and when equipment is when being in busy state, even if there is Debugging message to need to export, also need the I/O operation of preferential answering user.
Compared with prior art, the present invention revolutionizes in the past once the mechanism having Debugging message just directly to export, and makes Debugging message intelligent selection can export opportunity, neither affects user operation, be convenient to again location investigation fault; And the output of Debugging message becomes orderly, the situation that there will not be entanglement to intert, significantly improves user's impression and equipment easy applied performance.
(2) in the present invention, the size of buffer area, the probe interval cycle and free time threshold value, be all can carry out real time modifying by reserved configuration interface, farthest meet the different demands of different scene.
(3) in the present invention, the way of output of Debugging message is flexible, only can export a Debugging message at every turn, also can once export many Debugging message, can take the circumstances into consideration as the case may be to consider design, support real-time configuration modification.Further, Debugging message once be output, then deletes this information from buffer area, can clear up the space in buffer area in time, be convenient to the preservation of follow-up Debugging message.
(4) technical scheme mature and reliable of the present invention, upper layer application (namely exporting the functional module of Debugging message) is had no effect and revised, only revise the partial code of office terminal and the last partial code exported, change little, easy realization, stability is high, has very strong generalization.
Accompanying drawing explanation
Fig. 1 is that in the embodiment of the present invention, in embedded device, intelligence exports the process flow diagram of the method for Debugging message.
Embodiment
Below in conjunction with drawings and the specific embodiments, the present invention is described in further detail.
Shown in Figure 1, the embodiment of the present invention provides intelligence in a kind of embedded device to export the method for Debugging message, comprises the following steps:
S1: set up a buffer area for multistage pipeline information in the office terminal of embedded device, all Debugging message directly do not output to I/O interface, but are first buffered in described buffer area; Preset the probe interval cycle and free time threshold value, by the initialization time started when processing point be designated as time point value T1, proceed to S2.
S2: within each probe interval cycle, judges whether user has I/O operation, if so, then proceeds to S3; Otherwise, proceed to S4.
S3: the I/O operation performing user; Record current time, using current time as new time point value T1, namely update time point value T1, proceed to S7.
S4: calculate the difference between current time and time point value T1, judges whether described difference is greater than free time threshold value, if so, then shows currently to be in a kind of idle condition, proceeds to S5; Otherwise, show currently to be in a kind of busy state, proceed to S7.
S5: check in buffer area whether have Debugging message to be output, if so, then proceed to S6; Otherwise, proceed to S7.
S6: the Debugging message of specified entry quantity is outputted to I/O interface, proceeds to S7.
S7: judge whether to need to enter next probe interval cycle, if not, then terminate; If so, then return S2, wait for and enter the next probe interval cycle, namely from S2, proceed circular treatment.Circular treatment like this, then can reach Intelligent monitoring device state, and intelligence exports the effect of Debugging message, does not namely affect the I/O operation of user, can reach again the object of checking Debugging message smoothly.
During concrete operations, office terminal described in S1 can be virtual terminal VTY (VirtualTeletypeTerminal), can be also entity terminal, as serial interface, AUX interface etc.
The size of buffer area described in S1, can carry out real-time configuration modification according to user's request.Specifically, the size of buffer area, can adopt and first preset an initial value, then provides configuration interface to be configured amendment in real time for user, can meet the demand under different scene and application like this.Further, when buffer area remaining space is not enough, can takes but be not limited to following processing mode: the Debugging message before new Debugging message is covered, or directly abandoning new Debugging message.
In addition, the cycle of probe interval described in S1 can specify voluntarily according to the demand of producer or design, but generally can be set to 0.5 second ~ 2 seconds.Is set to a very short value probe interval cycle, its reason is: the office terminal of embedded device is all to monitor in present communications passage (fd for communicating) whether have I/O operation, if in present communications passage (fd), without any data input and output, then (the detection time interval exactly to I/O operation that " for a long time " is corresponding) communication port place can be blocked in herein for a long time, so just cannot monitor other objects (such as, cannot the buffer area set up being monitored).Therefore, in order to the output of quick, intelligent control Debugging message, advise the probe interval cycle to be set to, and the probe interval cycle is less very short time, faster to the response speed of user operation.
In addition, the cycle of probe interval described in S1 can adjust in real time according to exterior arrangement and instruction, does not need to use fixed value.Specifically, after presetting the probe interval cycle described in S1, real-time configuration modification can be carried out by reserved parameter/configuration interface to the probe interval cycle.
In like manner, free time described in S1 threshold value also advise not using fixed value, but outside configuration in real time can be carried out based on the concrete condition of each office terminal.Specifically, after presetting free time threshold value described in S1, real-time configuration modification can be carried out by reserved parameter/configuration interface to free time threshold value.
But it is to be noted that free time threshold value setting is larger, then user is when continued operation, and the middle dead time just can be longer, but when user's shut-down operation, until the time interval that Debugging message exports is also longer; Otherwise, free time threshold value setting is less, then user is when continued operation, the middle dead time is shorter, otherwise in the pause interval of user operation, may just because the dead time long (having exceeded the free time threshold value arranged), and there is Debugging message to export, but when user's shut-down operation, until the time interval that Debugging message exports is also shorter.
During practical operation, when Debugging message being outputted to I/O interface described in S6, only can export a Debugging message, also can once export many Debugging message.But the Debugging message exported is more, then slower to the response time of user operation.Each output how many Debugging message, first can adopt default settings (such as acquiescence is each exports), then, adjust in real time according to exterior arrangement and instruction.Specifically, when Debugging message being outputted to I/O interface described in S6, the number of the Debugging message of output first exports according to the number of default value, and then according to exterior arrangement and instruction, the number to the Debugging message exported adjusts in real time.
In addition, in order to enable buffer area reserve enough spaces to deposit follow-up newly-increased Debugging message, for the Debugging message exported, then need to discharge its buffer area taken.Specifically, after Debugging message being outputted to I/O interface described in S6, this Debugging message exported is deleted from buffer area.
The embodiment of the present invention also provides intelligence in a kind of embedded device to export the system of Debugging message, comprises initial setup module, Debugging message output module and detection judge module;
Wherein, described initial setup module is used for: in the office terminal of embedded device, set up a buffer area for multistage pipeline information; Preset in the office terminal of embedded device the probe interval cycle and free time threshold value, the initialization time started when processing point is designated as time point value T1, sends output processing signal to Debugging message output module;
Described Debugging message output module is used for: after receiving output processing signal, within each probe interval cycle, when user does not have I/O operation, judge that the difference between current time and time point value T1 is greater than free time threshold value, and in buffer area, have Debugging message to be output, then Debugging message is outputted to I/O interface, send to detection judge module and judge signal;
Described Debugging message output module is used for: receive after judging signal, and judging whether needs to enter next probe interval cycle, if so, sends output processing signal to Debugging message output module, waits for and enters the next probe interval cycle; Otherwise, quit work.
The monitoring equipment idle condition that in the present invention, the method for intelligence output Debugging message can be flexible, intelligent, take the method exporting Debugging message in an idle state, avoid the I/O operation conflict with user, and then improve the operating experience of user, add the ease for use of equipment.Wherein, the size of the buffer area set up, the probe interval cycle and free time threshold value, be all can carry out real time modifying by configuration of reservations interface, at utmost meet the different demands of different scene.And upper layer application (namely exporting the functional module of Debugging message) is had no effect and revised, only revise the partial code of office terminal and the last partial code exported, change little, easily realize, stability is also very high, has very strong generalization.
The present invention is not limited to above-mentioned embodiment, and the way of output of Debugging message includes but not limited to output to I/O interface, also can be output to file or log server etc.Here outputting to I/O interface, is only a citing.For those skilled in the art, under the premise without departing from the principles of the invention, can also make some improvements and modifications, these improvements and modifications are also considered as within protection scope of the present invention.The content be not described in detail in this instructions belongs to the known prior art of professional and technical personnel in the field.