Summary of the invention
For the problems referred to above that prior art exists, the object of the present invention is to provide the method to a kind of convenient and swift, visual pattern of built-in digital control system exploitation or maintainer, accurately and reliably built-in digital control system performance monitoring.
The technical scheme that the present invention adopts for achieving the above object is: a kind of method of built-in digital control system performance monitoring may further comprise the steps:
In built-in digital control system, each acquisition module is specified the shared drive subregion of a correspondence by the memory partitioning administration module; Acquisition module stores the performance index data that collect in the corresponding shared drive subregion into; Transport module is crossed Ethernet with the performance index data communication device in each shared drive subregion and is transferred to remote supervision system;
In remote supervision system, data extraction module receives the performance index data that transmit and is stored in the corresponding data file, by image display module the performance index data is graphically shown.
Described each acquisition module specifies the process of the shared drive subregion of a correspondence to be by the memory partitioning administration module:
According to the required shared drive partition size of acquisition module S, in shared drive, find out first partition size more than or equal to the Free Partition of S;
If the Free Partition that finds is first subregion of shared drive, the start address that this subregion then is set is 0; Otherwise the start address that this subregion is set is the end address of a upper subregion;
The end address of valid data in the Free Partition that finds is made as the start address of this subregion, and the data volume in the subregion is 0; The state of subregion is revised as " distributing " by " free time "; The subregion sign is made as the subregion sign NAME that the applicant is imported into;
If the Free Partition that finds is not that last subregion of shared drive and the next subregion of this Free Partition are " free time " states, 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 sign, data volume and data inclusion, and wherein the data inclusion is the performance index data, and the data category sign is data extraction module splitting datagram body and the foundation that deposits the corresponding data document in.
If described acquisition module removes, then need to discharge the shared drive subregion that it occupies from built-in digital control system.
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 be an idle shared drive subregion or the continuous a plurality of idle shared drive subregion that is adjacent before this shared drive subregion, then carrying out subregion merges: the first subregion H that finds the idle shared drive subregion of this section, its partition length is added the partition length of the shared drive subregion that will discharge, and the partition length of the shared drive subregion that discharge is made as 0; Otherwise, subregion H headed by the shared drive subregion that discharge;
If this shared drive subregion is not that last piece subregion and next the piece subregion in the shared drive is Free Partition, then merge Free Partition: the partition length of first subregion H is added the partition length of next piece shared drive subregion, and the partition length of this next piece shared drive subregion is made as 0; Otherwise, attonity;
Revise the end address of subregion H headed by the start address of all continuous idle shared drive subregions after the first subregion H.
Data in the described image display module reading out data document regularly 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; A plurality of data acquisition modules use respectively memory partitionings different in the shared drive, but their synchronous write shared drives can not cause conflict, have further improved access speed.
2. data transmission is reliable.Data transmission has adopted based on the Socket network programming of ICP/IP protocol and has finished communication between built-in digital control system and the remote supervision system, has guaranteed the reliability of data transmission.
3. expression visual pattern.Remote supervision system receives and resolves the packet that built-in digital control system sends, the mode display performance data of use curve figure.
4. be easy to expand new performance monitoring task.The storage of this system's performance data, transmission are finished by the data memory module in the built-in digital control system and data transfer task, for data acquisition, data are processed, figure shows the interface that standard is provided, if monitor new performance testing index, only need to add corresponding data acquisition module, add at data processing task and add corresponding observation interface to the analytic method of corresponding data and in figure demonstration task, and need not to be concerned about data are how the data of how to store, storing the details such as transmit.
Each performance data collection module independent of one another, do not interfere with each other.Each data acquisition figure shows that task is independent of one another in this model, 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
The present invention is described in further detail below in conjunction with drawings and Examples.
Fig. 1 is the system construction drawing of the present invention's built-in digital control system remote performance monitoring of using.
Method for a better understanding of the present invention now describes each module and task in the system one by one:
(1) shared drive module
Adopt all properties data to be stored in a mode in the shared drive in the inventive method, make things convenient for 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 collect it store in its corresponding subregion.
For the different demands of the required storage space that satisfies the different acquisition module, avoid again the waste of shared drive, each memory partitioning in the shared drive is not of uniform size, is dynamically to divide according to applicant's demand, and the applicant is exactly acquisition module.
The shared drive module mainly provides some to the interface of shared drive storage data;
Module initialization mainly is that continuous region of memory of application is used for all performance datas of centralized stores;
The module unloading realizes discharging shared drive.
(2) memory partitioning administration module
The memory partitioning administration module is used for managing shared memory, has defined a memory partitioning structure and has been used for describing all memory partitionings of shared drive.The memory partitioning structure is made of a partition information structure array and a subregion state array.Memory partitioning structure array has been described all memory partitioning information; The subregion state array has been described the current state of all subregions, and the state of subregion has and distributes and idle two kinds.
Described partition information structure is made of the data volume of depositing in the end address of valid data in subregion start address, partition length (take byte as unit), the subregion, the subregion and subregion sign.Subregion sign and partition length are specified by the acquisition module of this memory partitioning of application.
It is that subregion by the subregion during the memory partitioning application in the memory partitioning administration module is cut apart when reclaiming with memory partitioning merges to realize that described realization shared drive is dynamically divided.It is by one section continuous Free Partition in the shared drive that described subregion merges, the first partition length of the continuous Free Partition of this section is made as the length of the continuous subregion of this section, and all the other partition length all are made as 0 and realize.Described internal memory is cut apart when occurring in acquisition module application memory partitioning, at the head of the one section continuous Free Partition subregion that to mark off a length be the acquisition module Len req.
The initialization of memory partitioning administration module realizes the initialization to all memory partitionings in the shared drive.The 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 the subregion start address is 0; And all the other all partition length are 0, and the subregion start address is the end address of shared drive.
The division operation that the memory partitioning administration module provides comprises:
(a) obtain an idle shared drive subregion
Need to obtain a shared drive subregion during acquisition module initialization and be used for the memory property data;
Obtain the flow process of an idle shared drive subregion as shown in Figure 2, concrete steps are as follows:
1. the big or small S of acquisition module required memory subregion and subregion sign NAME can pass to this function as parameter;
2. from the header element of memory partitioning structure array, partition length and the S of each " free time " subregion compared, see whether more than or equal to it, until find first satisfactory idle shared drive subregion;
If 3. satisfactory this subregion is first subregion in the shared drive, the start address of this subregion is made as 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 that finds is made as the start address of this subregion, the data volume in the subregion is 0; The status modifier of subregion is " distributing "; The subregion sign is made as the subregion sign NAME that acquisition module imports into;
If the Free Partition that 5. finds is not that last subregion of shared drive and the next subregion of this subregion are idle, then this subregion is divided into two, the length of front portion is the acquisition module Len req, rear portion merges to next subregion, and partition length and the start address of the next subregion by revising the partition length will distribute subregion and this subregion realize;
6. this subregion is distributed to acquisition module.
(b) discharge certain memory partitioning
Need to discharge the shared drive subregion that it takies during the data acquisition module unloading;
Discharge the flow process of a shared drive subregion as shown in Figure 3, concrete steps are as follows:
1. the state with this shared drive subregion changes " free time " into;
2. before there is continuous idle shared drive blockette if discharge subregion, then carries out subregion and merge; By finding the first subregion H of this continuous free memory blockette, its partition length is added the partition length of the memory partitioning that will discharge, and want the partition length of releasing memory subregion to be made as 0;
3. before do not have continuous idle shared drive blockette if discharge subregion, then this shared drive subregion that will discharge is the first subregion H of continuous idle shared drive blockette;
4. if the release subregion is not that last piece subregion in the shared drive and next the piece subregion that discharges subregion are Free Partition, then merge Free Partition to subregion H;
The end address of subregion headed by the start address of other subregions of one section continuous free memory subregion (may only have the Free Partition that will discharge) except first subregion H that 5. will link to each other with the Free Partition that will discharge is all revised.
(c) empty the shared drive subregion
The shared drive subregion need to empty when the full or data transmission module of shared drive subregion was taken data away, was made as the data volume of depositing in the start address of shared drive subregion and the subregion by the end address with valid data in this subregion and was made as 0 and realizes;
(d) end address of valid data in the increase subregion
Deposit the end address that will increase accordingly valid data after the performance data in the memory partitioning, recruitment is the byte number that deposits performance data in;
(e) data volume in the increase subregion
The data acquisition task is every adds one group of data to the shared drive subregion, and the data volume of subregion will add one; Described one group of data generally are to be made of a sign performance attribution data person's key word and the performance number of expression performance index.
(3) acquisition module
Take the cpu busy percentage that gathers real-time task as example describes, utilize RTAI to realize;
Mainly finish when load gathering the data acquisition module of cpu busy percentage of real-time task in the built-in digital control system: periodic duty that is used for gathering the real-time task cpu busy percentage of initialization; A shared drive subregion that obtains in the shared drive is used for the data that storage of collected arrives, and establishing partition number is rttask_cpu_bno;
The task of described collection real-time task cpu busy percentage is real-time task, obtains periodically the real-time task cpu busy percentage and stores the memory partitioning that is numbered rttask_cpu_bno in the shared drive into, may further comprise the steps:
(a) when task initialization, execution time of all real-time tasks is made as 0, and obtains the time time1 of system;
When (b) duty cycle is carried out, obtain the time time2 of system
(c) traversal real-time task chained list, cpu busy percentage and the storage of obtaining each real-time task may further comprise the steps:
1. initialization one real-time task pointed rt_linux_task;
2. with the next real-time task of real-time task pointed;
3. judge whether this task pointer points to rt_linux_task, if the task pointer is sensing rt_linux_task then turns to 6.;
4. obtain the execution time exctime of task pointed task, exctime/ (time2-time1) is exactly the cpu busy percentage of this real-time task, deposits name and the cpu busy percentage thereof of this task in memory partitioning that shared drive is numbered rttask_cpu_bno;
5. the execution time of task pointed task is reset, turn to 2.;
6. obtain system time and be used for reseting time1;
7. wait for the next performance period
Unloading mainly comprises when gathering the acquisition module of cpu busy percentage of real-time task: deletion gathers the periodic duty of 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.At first monitor connection request, when remote supervision system sent connection request, two ends connected.Data transfer task begins cycle state in the shared drive is sent for the packing of the data in the shared drive subregion of " distributing "; The mode that adopts the data of each shared drive subregion to play a bag is so that the data extraction module classification is processed;
The formation of packet: at first being the subregion sign of shared drive subregion, is the foundation that data extraction task is processed packet classification, judges the mode of unpacking according to this sign; Next is the data volume of memory partitioning; The performance data of storage in the memory partitioning at last.
(5) data extraction module
Data are extracted the packet that receives are unpacked and the storage of classifying, and with this data basis as image display module.
Data processing task may further comprise the steps the processing procedure of packet:
(a) receive the packet that built-in digital control system sends over;
(b) obtain the data category sign of packet;
(c) obtain the data volume N of packet;
(d) according to the data category sign, according to corresponding mode the data inclusion is unpacked, obtain performance information, deposit corresponding data file in
Take the cpu busy percentage of real-time task as example, data are surrounded by N group data, and every group of data all are that title and the cpu busy percentage thereof by real-time task consists of.According to such data combination, one by one N is organized Data Division out, deposit the document of depositing the real-time task cpu busy percentage in.
(6) image display module
Be used for graphical display performance data;
Take the cpu busy percentage of real-time task as example, figure shows and may further comprise the steps:
(a) graphically show the observation interface of task initialization cpu busy percentage;
(b) performance data in the reading out data document connects demonstration with cpu busy percentage data use curve in observation interface of all current real-time tasks;
(c) data in regularly the reading out data document dynamically update the curve of real-time task cpu busy percentage according to the variation of the conversion of real-time task and cpu busy percentage thereof.
Data flow figure in the inventive method between each functional module may further comprise the steps as shown in Figure 4:
(a) all acquisition modules carry out the collection of performance data according to mode (such as modes such as cycle triggering, Event triggered) separately in the built-in digital control system, and the performance data that collects are deposited in the shared drive subregion of its pre-first to file;
(b) data transmission module in the built-in digital control system obtains periodically state in the shared drive and is the data of the shared drive subregion of " distributing ", encapsulates according to default data packet format, sends to remote supervision system;
(c) the data extraction module receive data transport module of remote supervision system passes the packet of coming, and the resolution data bag obtains performance data and deposits corresponding data file in;
(d) image display module obtains the system performance information in the data file periodically, and the figure that upgrades performance data shows.