Disclosure of Invention
The technical scheme provided by the invention is as follows:
the invention provides a method for detecting abnormal operation of wireless access equipment, which comprises the following steps: s10, when the wireless access device is abnormal, obtaining the value of the clock initialization mark; s20, acquiring the relative running time of the wireless access equipment when the wireless access equipment is abnormal according to the value of the clock initialization mark; s30, further acquiring the reference running time of the wireless access equipment according to the value of the clock initialization mark; s40, calculating the abnormal operation time of the wireless access equipment according to the relative operation time and the reference operation time of the wireless access equipment; the relative operating time refers to: when the wireless access equipment is abnormal, the wireless access equipment is relative to a timestamp operated when the wireless access equipment is electrified or connected with a network last time; the reference run time refers to: a system time of the wireless access device at power-up or last network connection within the reference area.
Further, before the step S10, the method further includes: s01, setting a clock initialization flag in the clock initialization process; s02, when the clock initialization is completed, setting the value of the clock initialization flag to be 1; and S03, when the clock initialization is not finished, setting the value of the clock initialization flag to be 0.
Further, the step S20 includes: s21, judging whether the value of the clock initialization flag is 1 or not; s22, when the value of the clock initialization flag is 1, acquiring the relative running time of the wireless access equipment when the wireless access equipment is abnormal; and S23, when the value of the clock initialization flag is 0, recording the relative running time of the wireless access equipment when the wireless access equipment is abnormal.
Further, the step S30 includes: and S31, when the value of the clock initialization flag is 1, further acquiring the reference running time of the wireless access device.
Further, the method also comprises the following steps: s50, calculating and recording the local abnormal operation time of the wireless access equipment according to the abnormal operation time of the wireless access equipment and the time difference between the reference area and the local area; the local area includes: the area of the wireless access equipment and the area of the administrator.
The present invention also provides a wireless access device, including: the acquisition module is used for acquiring the value of a clock initialization flag when the wireless access equipment is abnormal; the obtaining module is further configured to obtain, according to the value of the clock initialization flag, a relative operation time of the wireless access device when an abnormality occurs; the obtaining module is further configured to further obtain a reference running time of the wireless access device according to the value of the clock initialization flag; the computing module is used for computing the abnormal operation time of the wireless access equipment according to the relative operation time and the reference operation time of the wireless access equipment; the relative operating time refers to: when the wireless access equipment is abnormal, the wireless access equipment is relative to a timestamp operated when the wireless access equipment is electrified or connected with a network last time; the reference run time refers to: a system time of the wireless access device at power-up or last network connection within the reference area.
Further, still include: the setting module is used for setting a clock initialization mark in a clock initialization process; when the clock initialization is finished, setting the value of the clock initialization mark to be 1; when the clock initialization is not completed, the value of the clock initialization flag is set to 0.
Further, still include: the judging module is used for judging whether the value of the clock initialization mark is 1 or not; the obtaining module is further configured to obtain a relative operation time of the wireless access device when the value of the clock initialization flag is 1; and the recording module is used for recording the relative running time of the wireless access equipment when the value of the clock initialization flag is 0.
Further, the obtaining module is further configured to further obtain the reference running time of the wireless access device when the value of the clock initialization flag is 1.
Further, the calculation module is further configured to calculate and record a local abnormal operation time of the wireless access device according to the abnormal operation time of the wireless access device and a difference between the reference region and a local region; the local area includes: the area of the wireless access equipment and the area of the administrator.
Compared with the prior art, the method for detecting the abnormal operation of the wireless access equipment and the wireless access equipment have the following beneficial effects:
1) when the wireless access equipment is abnormal in the operation process, the invention identifies whether the wireless access equipment is in the operation process by utilizing the always initialized mark, and further detects the specific time when the wireless access equipment is abnormal in the operation process so as to help analyze the reason of the abnormality.
2) The invention utilizes the initialization mark all the time to identify whether the wireless access equipment is in the running process, firstly detects the relative running time of the wireless access equipment which is abnormal, and further detects the reference running time of the wireless access equipment which is abnormal; and finally, calculating to obtain the specific time when the wireless access equipment is abnormal in the operation process.
3) Before the wireless access equipment normally operates, namely in the initialization process, when an abnormal condition occurs, the relative time of the wireless access equipment which is abnormal is recorded.
4) After the invention detects the specific time when the wireless access equipment is abnormal in the operation process, the specific time can be converted into the local abnormal time, thereby being convenient for the user to check.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
As shown in fig. 1, according to an embodiment of the present invention, a method for detecting abnormal operation of a wireless access device includes the following steps: preferably, the method further comprises the following steps: s01, setting a clock initialization flag in the clock initialization process;
s02, when the clock initialization is completed, setting the value of the clock initialization flag to be 1;
and S03, when the clock initialization is not finished, setting the value of the clock initialization flag to be 0.
S10, when the wireless access device is abnormal, obtaining the value of the clock initialization mark;
s20, acquiring the relative running time of the wireless access equipment when the wireless access equipment is abnormal according to the value of the clock initialization mark;
s30, further acquiring the reference running time of the wireless access equipment according to the value of the clock initialization mark;
and S40, calculating the abnormal operation time of the wireless access equipment according to the relative operation time and the reference operation time of the wireless access equipment.
Specifically, at the end of the clock initialization process of the timer in the kernel startup process, the clock initialization flag print _ time _ finish _ initialization is set. After the timer finishes clock initialization, setting a clock initialization flag print _ time _ finish _ initialization to be 1; when the timer does not complete clock initialization, the clock initialization flag printk _ time _ finish _ initialization is set to 0. In the running process of the wireless access equipment, the wireless access equipment completes the kernel starting process; when the wireless access device is abnormal, for example: communication interruption, crash and the like, and whether the value of the clock initialization flag printk _ time _ finish _ initialization is 1 or 0 is obtained. Acquiring the relative running time and the reference running time of the wireless access equipment with abnormality according to the value of the clock initialization flag print _ time _ finish _ initialization; and then calculating the abnormal operation time of the wireless access equipment.
As shown in fig. 2, according to another embodiment of the present invention, a method for detecting abnormal operation of a wireless access device includes the following steps: preferably, the method further comprises the following steps: s01, setting a clock initialization flag in the clock initialization process;
s02, when the clock initialization is completed, setting the value of the clock initialization flag to be 1;
and S03, when the clock initialization is not finished, setting the value of the clock initialization flag to be 0.
S10, when the wireless access device is abnormal, obtaining the value of the clock initialization mark;
s21, judging whether the value of the clock initialization flag is 1 or not;
s22, when the value of the clock initialization flag is 1, acquiring the relative running time of the wireless access equipment when the wireless access equipment is abnormal;
s23, when the value of the clock initialization flag is 0, recording the relative running time of the wireless access equipment when the wireless access equipment is abnormal; the relative operating time refers to: and when the wireless access equipment is abnormal, the wireless access equipment is relative to a timestamp operated when the wireless access equipment is powered on or connected with a network last time.
S31, when the value of the clock initialization flag is 1, further acquiring the reference running time of the wireless access equipment; the reference run time refers to: a system time of the wireless access device at power-up or last network connection within the reference area.
And S40, calculating the abnormal operation time of the wireless access equipment according to the relative operation time and the reference operation time of the wireless access equipment.
Specifically, the method mainly calculates abnormal operation time when the wireless access equipment is abnormal in the operation process. When the crystal oscillator is arranged on the wireless access equipment, the time stamp and the system time are obtained according to the power-on of the wireless access equipment; when the wireless access device is not provided with the crystal oscillator, the timestamp and the system time are updated according to the internet access of the wireless access device.
When the value of the clock initialization flag print _ time _ finish _ initialization is 1, the kernel starts a timer in the process to complete clock initialization; please refer to the prior art and fig. 6, and details of the kernel boot process are not described herein. A timestamp, e.g., 300 seconds, is first obtained for the wireless access device to run with respect to the last time the wireless access device was powered on or last connected to the network. And then acquiring the system time of the wireless access device in the reference area when the wireless access device is powered on or connected with the network last time, such as 10 days on month 06 in 2010 and 10:10 in the morning. Time stamps, e.g., 300 seconds, according to system time, e.g., 10 days on 2010, 10 am, 10:10 am; and calculating the abnormal operation time of the wireless access equipment to be 10 days in 2010, 06 months and 10:15 in the morning.
When the value of the clock initialization flag print _ time _ finish _ initialization is 0, the kernel starts a timer in the flow, and the clock initialization is not completed, that is, the wireless access device does not operate; an anomaly occurs in the wireless access device and a timestamp, e.g., 300 seconds, of the wireless access device running when the wireless access device was powered on or last connected to the network is directly recorded.
As shown in fig. 3, according to another embodiment of the present invention, a method for detecting abnormal operation of a wireless access device includes the following steps: preferably, the method further comprises the following steps: s01, setting a clock initialization flag in the clock initialization process;
s02, when the clock initialization is completed, setting the value of the clock initialization flag to be 1;
and S03, when the clock initialization is not finished, setting the value of the clock initialization flag to be 0.
S10, when the wireless access device is abnormal, obtaining the value of the clock initialization mark;
s21, judging whether the value of the clock initialization flag is 1 or not;
s22, when the value of the clock initialization flag is 1, acquiring the relative running time of the wireless access equipment when the wireless access equipment is abnormal;
s23, when the value of the clock initialization flag is 0, recording the relative running time of the wireless access equipment when the wireless access equipment is abnormal; the relative operating time refers to: and when the wireless access equipment is abnormal, the wireless access equipment is relative to a timestamp operated when the wireless access equipment is powered on or connected with a network last time.
S31, when the value of the clock initialization flag is 1, further acquiring the reference running time of the wireless access equipment; the reference run time refers to: a system time of the wireless access device at power-up or last network connection within the reference area.
And S40, calculating the abnormal operation time of the wireless access equipment according to the relative operation time and the reference operation time of the wireless access equipment.
S50, calculating and recording the local abnormal operation time of the wireless access equipment according to the abnormal operation time of the wireless access equipment and the time difference between the reference area and the local area; the local area includes: the area of the wireless access equipment and the area of the administrator.
Specifically, when the wireless access device is located in area a, such as beijing; administrators are located in region B, e.g., the united states; the abnormal operation time of the wireless access equipment refers to the abnormal operation time of the wireless access equipment in the area A; when the administrator is located in the area B, the abnormal operation time of the wireless access equipment in the area A is converted into the abnormal operation time of the wireless access equipment in the area B.
When the wireless access equipment is located in a B area (such as Xinjiang) and is connected with a network, the wireless access equipment calculates abnormal operation time according to network time, and if the network times according to an A area (Beijing); and converting the abnormal operation time of the area A of the wireless access equipment into the abnormal operation time of the wireless access equipment in the area B.
As shown in fig. 4, according to an embodiment of the present invention, a wireless access device includes: preferably, the method further comprises the following steps: a setting module 10, configured to set a clock initialization flag in a clock initialization process; when the clock initialization is finished, setting the value of the clock initialization mark to be 1; when the clock initialization is not completed, the value of the clock initialization flag is set to 0.
An obtaining module 20, configured to obtain a value of a clock initialization flag when the wireless access device is abnormal;
a judging module 30, configured to judge whether a value of the clock initialization flag is 1;
the obtaining module 20 is further configured to obtain, when the value of the clock initialization flag is 1, a relative running time of the wireless access device when the wireless access device is abnormal;
a recording module 50, configured to record, when the value of the clock initialization flag is 0, a relative operation time of the wireless access device when an exception occurs; the relative operating time refers to: and when the wireless access equipment is abnormal, the wireless access equipment is relative to a timestamp operated when the wireless access equipment is powered on or connected with a network last time.
The obtaining module 20 is further configured to further obtain a reference running time of the wireless access device when the value of the clock initialization flag is 1; the reference run time refers to: a system time of the wireless access device at power-up or last network connection within the reference area.
And the calculating module 40 is configured to calculate an abnormal operation time of the wireless access device according to the relative operation time and the reference operation time of the wireless access device.
The calculating module 40 is further configured to calculate and record the local abnormal operation time of the wireless access device by using the recording module 50 according to the abnormal operation time of the wireless access device and the time difference between the reference region and the local region; the local area includes: the area of the wireless access equipment and the area of the administrator.
As shown in fig. 5, according to another embodiment of the present invention, a method for detecting abnormal operation of a wireless access device includes the following steps: after the time and timer initialization is completed, an initialization completion flag is set to print _ time _ finish _ initialization and set to 1. Modifying the display timestamp function code of the kernel printing function into a display date and time;
entering a vprintk () function, and judging whether clock initialization is completed; that is, whether the value of the initialization completion flag printk _ time _ finish _ initialization is 1 is checked; printing a time stamp when the value of the initialization completion flag printk _ time _ finish _ initialization is 0; the timestamp is a relative time since the AP was powered on, and is not a specific time when the exception information occurred. When the value of the initialization completion flag printk _ time _ finish _ initialization is 1, a do _ gettime _ offset () function is called to obtain the current time, and the do _ gettime _ offset () function obtains the current time by using the timestamp and the system time. And then calls the time _ to _ tm () function to convert the current time to the local time. The time stamp and the local time of printing are returned to the time scalar tbuf, and the time stamp and the local time of printing are recorded.
printk () is a function running in the kernel that outputs a display to the console. And setting a clock initialization completion flag by modifying the function, calling a time acquisition function after initialization is completed, and acquiring and updating time. When the function printing information is called to a screen in the running process of the AP, the current date and time are added in front of the information, so that the moment when the AP running abnormity occurs is positioned.
Conventionally, an ap (access point) device sometimes has an exception during use, and printed information is viewed on a screen through Telnet or Serial, and only a time stamp in front of the exception information (printed through a printk function) can be viewed. The information printed to the screen by the printk () function can be viewed as to the relative time since the AP was powered on.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.