Summary of the invention
For the problems referred to above that prior art exists, the object of the present invention is to provide to the method for built-in digital control system exploitation or a kind of convenient and swift, visual pattern of maintainer, built-in digital control system performance monitoring accurately and reliably.
The technical scheme that the present invention is adopted for achieving the above object is: a kind of method of built-in digital control system performance monitoring, comprises the following steps:
In built-in digital control system, each acquisition module specifies a corresponding shared drive subregion by memory partitioning administration module; The performance index data collected are stored in corresponding shared drive subregion by acquisition module; Performance index data in each shared drive subregion are transferred to remote supervision system by Ethernet by transport module;
In remote supervision system, data extraction module receives the performance index data that transmit and is stored in corresponding data file, carries out graphic software platform by image display module to performance index data.
Described each acquisition module specifies the process of a corresponding shared drive subregion to be by memory partitioning administration module:
Shared drive partition size S needed for acquisition module, finds out the Free Partition that first partition size is more than or equal to S in shared drive;
If the Free Partition found is first subregion of shared drive, then the start address arranging this subregion is 0; Otherwise the start address arranging this subregion is the end address of a upper subregion;
The end address of valid data in the Free Partition found is set to the start address of this subregion, and the data volume in subregion is 0; The state of subregion was revised as " distributing " by " free time "; Partition identification is set to the partition identification NAME that applicant is imported into;
If the Free Partition found is not last subregion of shared drive and the next subregion of this Free Partition is " free time " state, then this subregion is divided into two, the length of front portion is S, and rear portion merges to next subregion, returns the numbering of this Free Partition to acquisition module; Otherwise, directly return the numbering of this Free Partition to acquisition module.
Described transport module transmits after each shared drive subregion is broken into a packet again.
Described packet comprises data category mark, data volume and data inclusion, and wherein data inclusion is performance index data, and data category mark is data extraction module splitting datagram body and the foundation stored in corresponding data document.
If described acquisition module removes from built-in digital control system, then need to discharge its shared drive subregion occupied.
The release steps of described shared drive subregion is:
The state of the shared drive subregion that will discharge changes the free time into;
If there is the idle shared drive subregion or the multiple idle shared drive subregion of continuous print that are adjacent before this shared drive subregion, then carry out subregion merging: the first subregion H finding this section of idle shared drive subregion, its partition length is added the partition length of the shared drive subregion that will discharge, the partition length of the shared drive subregion that discharge is set to 0; Otherwise, subregion H headed by the shared drive subregion that discharge;
If this shared drive subregion is not last block subregion in shared drive and next block subregion is Free Partition, then merge Free Partition: the partition length partition length of first subregion H being added next block shared drive subregion, the partition length of this next block shared drive subregion is set to 0; Otherwise, attonity;
After revising first subregion H the idle shared drive subregion of all continuous print start address headed by the end address of subregion H.
Data in the reading data file of described image display module timing, dynamically update monitoring curve.
The present invention has the following advantages:
1. real-time is good.Adopt shared drive memory property data access speed fast; Multiple data acquisition module uses memory partitionings different in shared drive respectively, and they can not cause conflict by synchronous write shared drive, further increase access speed.
2. data transmission is reliable.The data transmission Socket network programming that have employed based on ICP/IP protocol completes the communication between built-in digital control system and remote supervision system, ensure that the reliability that data are transmitted.
3. express visual pattern.Remote supervision system receives and resolves the packet of built-in digital control system transmission, the mode display performance data of use curve figure.
4. be easy to expand new performance monitoring task.In this system performance data storage, transmit and completed by the data memory module in built-in digital control system and data transfer task, for data acquisition, data processing, figure show the interface providing specification, to monitor new performance testing index, only need to add corresponding data acquisition module, add the analytic method of corresponding data at data processing task and add corresponding observation interface in figure display task, and without the need to being concerned about data such as how to store, how the data that store are transmitted at the details.
5. each performance data collection module independent of one another, do not interfere with each other.In this model, each data acquisition figure display task is independent of one another, and the interface shared drive that they just utilize shared drive module and memory management module to provide, can not have influence on other monitoring task to the change of certain monitoring task.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail.
Fig. 1 is the system construction drawing of the built-in digital control system remote performance monitoring that the present invention applies.
Method for a better understanding of the present invention, is now described each module in system and task one by one:
(1) shared drive module
Adopt all properties data to be stored in mode in a shared drive in the inventive method, facilitate data management and transmission.
Shared drive is carried out subregion, and each subregion is corresponding with an acquisition module, and the data that each acquisition module can only be collected are stored in the subregion of its correspondence.
In order to meet the different demands of storage space needed for different acquisition module, avoid again the waste of shared drive, each memory partitioning in shared drive is not of uniform size, and be dynamically divide according to the demand of applicant, applicant is exactly acquisition module.
Shared drive module mainly provides some to store the interface of data to shared drive;
Module initialization mainly applies for that one piece of continuous print region of memory is for all performance data of centralized stores;
Module unloading realizes release shared drive.
(2) memory partitioning administration module
Memory partitioning administration module is used for managing shared memory, defines a memory partitioning structure for describing all memory partitionings in shared drive.Memory partitioning structure is made up of a partition information Array for structural body and a subregion state array.Memory partitioning Array for structural body describes all memory partitionings information; Subregion state array describes the current state of all subregions, and the state of subregion has distributes and idle two kinds.
Described partition information structure is made up of the data volume deposited in the end address of valid data in subregion start address, partition length (in units of byte), subregion, subregion and partition identification.Partition identification and partition length are by applying for that the acquisition module of this memory partitioning is specified.
It is described that to realize that shared drive dynamically divides be that subregion merging when being reclaimed by the subregion segmentation in the administration module of memory partitioning during the application of memory partitioning and memory partitioning is realized.It is by one section of continuous print Free Partition in shared drive that described subregion merges, and the first partition length of this section of continuous Free Partition is set to the length of this section of continuous zoning, and all the other partition length is all set to 0 realization.When described internal memory segmentation occurs in acquisition module application memory partitioning, mark off at the head of one section of continuous Free Partition the subregion that a length is acquisition module Len req.
The initialization of memory partitioning administration module realizes the initialization to memory partitionings all in shared drive.Shared drive original state is the continuous Free Partition of a monoblock, and namely, first partition length of shared drive is the length of whole shared drive, and subregion start address is 0; And all the other all partition length are 0, subregion start address is the end address of shared drive.
The division operation that memory partitioning administration module provides comprises:
A () obtains an idle shared drive subregion
Need acquisition shared drive subregion for memory property data during acquisition module initialization;
Obtain the flow process of an idle shared drive subregion as shown in Figure 2, concrete steps are as follows:
1. the size S of acquisition module required memory subregion and partition identification NAME can pass to this function as parameter;
2. from the header element of memory partitioning Array for structural body, the partition length of each " free time " subregion and S are compared, sees and whether be more than or equal to it, until find first satisfactory idle shared drive subregion;
If 3. this subregion satisfactory is first subregion in shared drive, the start address of this subregion is set to 0, otherwise the start address of this subregion is the end address of a upper subregion, namely start address and partition length sum;
4. the end address of valid data in the Free Partition found is set to the start address of this subregion, the data volume in subregion is 0; The status modifier of subregion is " distributing "; Partition identification is set to the partition identification NAME that acquisition module imports into;
If the Free Partition 5. found is not last subregion of shared drive and the next subregion of this subregion is idle, then this subregion is divided into two, the length of front portion is acquisition module Len req, rear portion merges to next subregion, will be distributed partition length and the start address realization of the partition length of subregion and the next subregion of this subregion by amendment;
6. this subregion is distributed to acquisition module.
B () discharges certain memory partitioning
Need to discharge its shared drive subregion taken during data acquisition module unloading;
As shown in Figure 3, concrete steps are as follows for the flow process of a release shared drive subregion:
1. the state of this shared drive subregion is changed into " free time ";
If there is the idle shared drive blockette of continuous print before 2. subregion will being discharged, then carry out subregion merging; By finding the first subregion H of this continuous print free memory blockette, its partition length being added the partition length of the memory partitioning that will discharge, and wanting the partition length of releasing memory subregion to be set to 0;
If there is not the idle shared drive blockette of continuous print before 3. will discharging subregion, then this shared drive subregion that will discharge is the first subregion H of continuous idle shared drive blockette;
If subregion 4. will be discharged be not last block subregion in shared drive and next block subregion of release subregion is Free Partition, then merge Free Partition to subregion H;
5. the end address of subregion headed by the start address of other subregions of one section of continuous print free memory subregion (may only have the Free Partition that will discharge) except first subregion H be connected with the Free Partition that will discharge all being revised.
C () empties shared drive subregion
When full the or data transmission module of shared drive subregion takes data away, shared drive subregion needs to empty, and is set to 0 realization by the end address of valid data in this subregion being set to the data volume deposited in the start address of shared drive subregion and subregion;
D () increases the end address of valid data in subregion
Will increase the end address of valid data after depositing performance data in memory partitioning accordingly, recruitment is the byte number stored in performance data;
E () increases the data volume in subregion
Data acquisition session often adds one group of data to shared drive subregion, and the data volume of subregion will add one; One group of described data are generally by the key word of a mark performance attribution data person and represent that the performance number of performance index is formed.
(3) acquisition module
Be described for the cpu busy percentage gathering real-time task, utilize RTAI to realize;
Mainly complete when loading the data acquisition module of the cpu busy percentage gathering real-time task in built-in digital control system: initialization one is for gathering the periodic duty of real-time task cpu busy percentage; The shared drive subregion obtained in shared drive is used for the data that storage of collected arrives, if partition number is rttask_cpu_bno;
The task of described collection real-time task cpu busy percentage is real-time task, obtains real-time task cpu busy percentage periodically and is stored in shared drive the memory partitioning being numbered rttask_cpu_bno, comprising the following steps:
A the execution time of all real-time tasks is set to 0 when task initialization by (), and obtain the time time1 of system;
When () duty cycle performs b, obtain the time time2 of system
C () traversal real-time task chained list, obtains the cpu busy percentage of each real-time task and stores, comprising the following steps:
1. initialization one real-time task pointed rt_linux_task;
2. by next for real-time task pointed real-time task;
3. judge whether this task pointer points to rt_linux_task, if task pointer points to rt_linux_task, turn to 6.;
4. the execution time exctime that task pointer points to task is obtained, exctime/ (time2-time1) is exactly the cpu busy percentage of this real-time task, and the name of this task and cpu busy percentage thereof are numbered the memory partitioning of rttask_cpu_bno stored in shared drive;
5. execution time task pointer being pointed to task resets, and turns to 2.;
6. obtain system time to be used for reseting time1;
7. the next performance period is waited for
Unloading mainly comprises when gathering the acquisition module of the cpu busy percentage of real-time task: delete the periodic duty gathering real-time task cpu busy percentage; Release is numbered the memory partitioning of rttask_cpu_bno.
(4) transport module
Built-in digital control system carries out communication by transport module and remote supervision system.First monitor connection request, when remote supervision system sends connection request, two ends connect.The data packing that what data transfer task started the cycle by state in shared drive is in the shared drive subregion of " distributing " sends; The data of each shared drive subregion are adopted to make a call to the mode of a bag, so that data extraction module classification process;
The formation of packet: the partition identification being first shared drive subregion, is the foundation of data extraction task to packet classification process, judges the mode of unpacking according to this mark; Next is the data volume of memory partitioning; It is finally the performance data stored in memory partitioning.
(5) data extraction module
Data are extracted and are unpacked and storage of classifying by the packet received, and basic in this, as the data of image display module.
The processing procedure of data processing task to packet comprises the following steps:
A () receives the packet that built-in digital control system sends over;
B () obtains the data category mark of packet;
C () obtains the data volume N of packet;
D (), according to data category mark, is unpacked to data inclusion according to corresponding mode, obtain performance information, stored in corresponding data file
For the cpu busy percentage of real-time task, data are surrounded by N group data, and often organizing data is all be made up of the title of real-time task and cpu busy percentage thereof.According to such data assemblies, one by one by N group Data Division out, stored in the document depositing real-time task cpu busy percentage.
(6) image display module
For graphic software platform performance data;
For the cpu busy percentage of real-time task, figure display comprises the following steps:
The observation interface of (a) graphic software platform task initialization cpu busy percentage;
B () reads the performance data in data file, the cpu busy percentage data of current all real-time tasks use curve in observation interface is carried out connection display;
C data in the reading data file of () timing, upgrade the curve of real-time task cpu busy percentage according to the conversion of real-time task and the change tread of cpu busy percentage thereof.
Data flow figure in the inventive method between each functional module as shown in Figure 4, comprises the following steps:
A acquisition modules all in () built-in digital control system carries out the collection of performance data according to respective mode (as modes such as cycle triggering, event triggerings), and by the performance data that collects stored in the shared drive subregion of its pre-first to file;
B the data transmission module in () built-in digital control system obtains state in shared drive is periodically the data of the shared drive subregion of " distributing ", encapsulates, send to remote supervision system according to the data packet format preset;
C the data extraction module of () remote supervision system receives data transmission module and passes the packet of coming, resolution data bag obtains performance data stored in corresponding data file;
D () image display module obtains the system performance information in data file periodically, upgrade the figure display of performance data.