CN106155865A - A kind of CPI acquisition methods, system and process performance judgement system in real time - Google Patents

A kind of CPI acquisition methods, system and process performance judgement system in real time Download PDF

Info

Publication number
CN106155865A
CN106155865A CN201610622303.6A CN201610622303A CN106155865A CN 106155865 A CN106155865 A CN 106155865A CN 201610622303 A CN201610622303 A CN 201610622303A CN 106155865 A CN106155865 A CN 106155865A
Authority
CN
China
Prior art keywords
real
linux
time
cpi
clock cycle
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.)
Pending
Application number
CN201610622303.6A
Other languages
Chinese (zh)
Inventor
王垒
徐亚洲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201610622303.6A priority Critical patent/CN106155865A/en
Publication of CN106155865A publication Critical patent/CN106155865A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording 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/3409Recording 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 for performance assessment

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

This application discloses the real-time CPI acquisition methods of a kind of Linux process, including: called by system, obtain the cpu clock cycle that Linux process is corresponding in real time, and acquisition Linux process effective instruction within the cpu clock cycle performs sum in real time;Utilize cpu clock cycle and effective instruction to perform sum, determine the real-time CPI index corresponding with Linux process.The application obtains the cpu clock cycle corresponding to Linux process by utilizing system to call in real time, and obtain Linux process effective instruction within the above-mentioned cpu clock cycle and perform sum, it is then based on the cpu clock cycle and effective instruction performs sum and determines the real-time CPI index corresponding to current Linux process, thus achieve the purpose that CPI index real-time to process obtains.It addition, disclosed herein as well is a kind of CPI in real time to obtain system and Linux process performance judgement system.

Description

A kind of CPI acquisition methods, system and process performance judgement system in real time
Technical field
The present invention relates to process performance monitoring technical field, particularly to one real-time CPI acquisition methods, system and process Performance criteria system.
Background technology
Currently, along with the fast development of high-performance server application, application developer increasingly payes attention to Linux process Performance.By knowing the performance information of Linux process in advance, application developer can more clearly know should be what side In the face of Linux process carries out next step optimization.
And the CPI of Linux process (i.e. Clock Cycle Per Instruction instructs average clock periodicity) is Judge the key index that Linux process is good and bad, if it is possible to know the CPI index of Linux process in advance, then can sentence easily Break and the quality of Linux process performance.And the real-time CPI index how obtaining Linux process is to need asking of solution at present Topic.
Summary of the invention
In view of this, it is an object of the invention to provide the real-time CPI acquisition methods of a kind of Linux process, it is achieved that obtain Take the purpose of the real-time CPI index of Linux process.Further, present invention also offers a kind of CPI in real time obtain system and Linux process performance judgement system.Its concrete scheme is as follows:
A kind of real-time CPI acquisition methods of Linux process, including:
Called by system, obtain in real time the cpu clock cycle that Linux process is corresponding, and obtain described Linux in real time and enter Journey effective instruction within the described cpu clock cycle performs sum;
Utilize described cpu clock cycle and described effective instruction to perform sum, determine the reality corresponding with described Linux process Time CPI index.
Preferably, the system after described system is called as encapsulation is called.
Preferably, described called by system, obtain the cpu clock cycle that Linux process is corresponding in real time, and obtain in real time Described Linux process effective instruction within the described cpu clock cycle performs the process of sum, including:
The system after described encapsulation that previously generates is called;
Utilize the system after described encapsulation to call, obtain the described cpu clock cycle in real time and described effective instruction performs total Number.
Preferably, described in previously generate described encapsulation after the process called of system, including:
Obtain the process pid parameter of described Linux process in advance;
According to described process pid parameter, the sys_perf_event_open system in linux system is called and seals Dress processes, and obtains the system after described encapsulation and calls.
Preferably, the described process determining the real-time CPI index corresponding with described Linux process, including:
The described cpu clock cycle is performed sum divided by described effective instruction, obtains described real-time CPI index.
Preferably, after the described process determining the real-time CPI index corresponding with described Linux process, also include:
PMU data in linux system is emptied process.
The real-time CPI that the invention also discloses a kind of Linux process obtains system, including:
Data obtaining module, for being called by system, obtains the cpu clock cycle that Linux process is corresponding in real time, and real Time obtain described Linux process effective instruction within the described cpu clock cycle and perform sum;
CPI computing module, is used for utilizing described cpu clock cycle and described effective instruction to perform sum, determines with described The real-time CPI index that Linux process is corresponding.
Preferably, the system after described system is called as encapsulation is called.
Preferably, described data obtaining module includes:
Generating submodule, the system after previously generating described encapsulation is called;
Obtaining submodule, the system after utilize described encapsulation is called, and obtains described cpu clock cycle and described in real time Effective instruction performs sum.
Preferably, described generation submodule includes:
Pid parameter acquiring unit, is used for obtaining in advance the process pid parameter of described Linux process;
System calls encapsulation unit, for according to described process pid parameter, to the sys_perf_ in linux system Event_open system is called and is packaged processing, and obtains the system after described encapsulation and calls.
The present invention further discloses a kind of Linux process performance judgement system, obtain including aforementioned disclosed CPI in real time System, also includes:
Performance judging module, for utilizing the real-time CPI index obtained in described real-time CPI acquisition system, to described The performance of Linux process judges in real time, obtains corresponding process real-time performance information.
In the present invention, real-time CPI acquisition methods, including: called by system, obtain the CPU that Linux process is corresponding in real time Clock cycle, and acquisition Linux process effective instruction within the cpu clock cycle performs sum in real time;Utilize the cpu clock cycle Perform sum with effective instruction, determine the real-time CPI index corresponding with Linux process.In the present invention, by utilizing system to adjust It is used for obtaining in real time the cpu clock cycle corresponding to Linux process, and obtains Linux process within the above-mentioned cpu clock cycle Effective instruction perform sum, be then based on the above-mentioned cpu clock cycle and effective instruction perform sum, it may be determined that go out current Real-time CPI index corresponding to Linux process, thus achieves the mesh that the real-time CPI index to Linux process obtains 's.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing In having technology to describe, the required accompanying drawing used is briefly described, it should be apparent that, the accompanying drawing in describing below is only this Inventive embodiment, for those of ordinary skill in the art, on the premise of not paying creative work, it is also possible to according to The accompanying drawing provided obtains other accompanying drawing.
Fig. 1 is the real-time CPI acquisition methods flow chart of a kind of Linux process disclosed in the embodiment of the present invention;
Fig. 2 is that the real-time CPI of a kind of Linux process disclosed in the embodiment of the present invention obtains system structure schematic diagram.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Describe, it is clear that described embodiment is only a part of embodiment of the present invention rather than whole embodiments wholely.Based on Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under not making creative work premise Embodiment, broadly falls into the scope of protection of the invention.
The embodiment of the invention discloses the real-time CPI acquisition methods of a kind of Linux process, shown in Figure 1, the method bag Include:
Step S11: called by system, is obtained the cpu clock cycle that Linux process is corresponding in real time, and obtains in real time Linux process effective instruction within the cpu clock cycle performs sum.
That is, obtain having in the cpu clock cycle corresponding to Linux process and this cpu clock cycle the most in real time Effect instruction performs sum.Further, the present embodiment is to be called by system, obtains above-mentioned cpu clock cycle and above-mentioned effective finger Order performs sum.
Step S12: utilize above-mentioned cpu clock cycle and above-mentioned effective instruction to perform sum, determine corresponding with Linux process Real-time CPI index.
That is, the embodiment of the present invention is to perform sum based on cpu clock cycle and effective instruction to enter real-time CPI index Row determines.
In the embodiment of the present invention, real-time CPI acquisition methods, including: called by system, obtain Linux process pair in real time The cpu clock cycle answered, and acquisition Linux process effective instruction within the cpu clock cycle performs sum in real time;Utilize CPU Clock cycle and effective instruction perform sum, determine the real-time CPI index corresponding with Linux process.In embodiments of the present invention, Obtain the cpu clock cycle corresponding to Linux process by utilizing system to call in real time, and obtain Linux process upper The effective instruction stated in the cpu clock cycle performs sum, is then based on the above-mentioned cpu clock cycle and effective instruction performs sum, Can determine that the real-time CPI index corresponding to current Linux process, thus achieve the real-time CPI index to Linux process Carry out the purpose obtained.
The embodiment of the invention discloses the real-time CPI acquisition methods of a kind of concrete Linux process, implement relative to upper one Example, technical scheme has been made further instruction and optimization by the present embodiment.Concrete:
In a upper embodiment, called by system, the cpu clock cycle can be got and effective instruction performs sum.Wherein, Said system is called the system after being specifically as follows encapsulation and is called, and that is to say that the system obtained after encapsulation is called.
Concrete, in upper embodiment step S11, called by system, during the CPU that acquisition Linux process is corresponding in real time The clock cycle, and obtain the process of Linux process effective instruction execution sum within the cpu clock cycle in real time, it may include below Step S111 and S112;Wherein,
Step S111: the system after above-mentioned encapsulation that previously generates is called;
Step S112: utilize the system after above-mentioned encapsulation to call, obtains above-mentioned cpu clock cycle and above-mentioned effective finger in real time Order performs sum.
More specifically, in above-mentioned steps S111, previously generate the process that the system after encapsulation is called, can include walking below Rapid S1111 and S1112;Wherein,
Step S1111: obtain the process pid parameter (PID, i.e. Process identifier) of Linux process in advance;
Step S1112: according to above-mentioned process pid parameter, to the sys_perf_event_open system in linux system Calling and be packaged processing, the system after being encapsulated is called.It should be noted that above-mentioned sys_perf_event_open is The system carried in linux system is called.
It addition, in upper embodiment step S12, determine the process of the real-time CPI index corresponding with Linux process, specifically May include that and the cpu clock cycle is performed sum divided by effective instruction, obtain real-time CPI index.
Certainly, the mapping relations table that the embodiment of the present invention can also be preset by search, find and above-mentioned real-time CPI Index.It is understood that above-mentioned mapping relations table be pre-created between record object parameter and CPI index map The tables of data of relation, wherein, above-mentioned target component includes that above-mentioned cpu clock cycle and effective instruction perform sum.
Further, in the present embodiment, after determining the process of the real-time CPI index corresponding with Linux process, also may be used So that PMU (the i.e. Performance Monitor Unit) data in linux system are emptied process.
Accordingly, the real-time CPI that the embodiment of the invention also discloses a kind of Linux process obtains system, sees Fig. 2 institute Showing, this system includes:
Data obtaining module 21, for being called by system, obtains the cpu clock cycle that Linux process is corresponding in real time, and Obtain Linux process effective instruction within the cpu clock cycle in real time and perform sum;
CPI computing module 22, is used for utilizing cpu clock cycle and effective instruction to perform sum, determines and Linux process pair The real-time CPI index answered.
In embodiments of the present invention, the cpu clock corresponding to Linux process is obtained by utilizing system to call in real time Cycle, and obtain Linux process effective instruction within the above-mentioned cpu clock cycle and perform sum, it is then based on above-mentioned cpu clock Cycle and effective instruction perform sum, it may be determined that go out the real-time CPI index corresponding to current Linux process, thus achieve The purpose that the real-time CPI index of Linux process is obtained.
In the present embodiment, said system is called the system after being specifically as follows encapsulation and is called.
Accordingly, above-mentioned data obtaining module specifically includes generation submodule and obtains submodule;Wherein,
Generating submodule, the system after previously generating above-mentioned encapsulation is called;
Obtaining submodule, the system after utilizing above-mentioned encapsulation is called, and obtains cpu clock cycle and effective instruction in real time Perform sum.
It addition, above-mentioned generation submodule specifically includes pid parameter acquiring unit and pid parameter acquiring unit;Wherein,
Pid parameter acquiring unit, for the process pid parameter of acquisition Linux process in advance;
System calls encapsulation unit, for according to process pid parameter, to the sys_perf_event_ in linux system Open system is called and is packaged processing, and the system after being encapsulated is called.
The embodiment of the present invention further discloses Linux process performance judgement system, disclosed in previous embodiment CPI obtains system in real time, also includes:
Performance judging module, for utilizing the real-time CPI index obtained in above-mentioned real-time CPI acquisition system, enters Linux The performance of journey judges in real time, obtains corresponding process real-time performance information.
That is, the embodiment of the present invention is to judge the real-time performance of current Linux process based on above-mentioned real-time CPI index 's.
Finally, in addition it is also necessary to explanation, in this article, term " includes ", " comprising " or its any other variant are intended to Contain comprising of nonexcludability, so that include that the process of a series of key element, method, article or equipment not only include those Key element, but also include other key elements being not expressly set out, or also include for this process, method, article or set Standby intrinsic key element.In the case of there is no more restriction, statement " including ... " key element limited, it is not excluded that Other identical element is there is also in including the process of described key element, method, article or equipment.
CPI acquisition methods real-time to one provided by the present invention, system and process performance judgement system are carried out above Being discussed in detail, principle and the embodiment of the present invention are set forth by specific case used herein, above example Method and the core concept thereof being only intended to help to understand the present invention is described;Simultaneously for one of ordinary skill in the art, depend on According to the thought of the present invention, the most all will change, in sum, this specification content Should not be construed as limitation of the present invention.

Claims (11)

1. the real-time CPI acquisition methods of a Linux process, it is characterised in that including:
Called by system, obtain in real time the cpu clock cycle that Linux process is corresponding, and obtain described Linux process in real time and exist Effective instruction in the described cpu clock cycle performs sum;
Utilize described cpu clock cycle and described effective instruction to perform sum, determine corresponding with described Linux process real-time CPI index.
The real-time CPI acquisition methods of Linux process the most according to claim 1, it is characterised in that described system call into System after encapsulation is called.
The real-time CPI acquisition methods of Linux process the most according to claim 2, it is characterised in that described adjusted by system With, obtain the cpu clock cycle that Linux process is corresponding in real time, and obtain described Linux process in real time in described cpu clock week Effective instruction in phase performs the process of sum, including:
The system after described encapsulation that previously generates is called;
Utilize the system after described encapsulation to call, obtain the described cpu clock cycle in real time and described effective instruction performs sum.
The real-time CPI acquisition methods of Linux process the most according to claim 3, it is characterised in that described in previously generate institute State the process that the system after encapsulation is called, including:
Obtain the process pid parameter of described Linux process in advance;
According to described process pid parameter, the sys_perf_event_open system in linux system is called and is packaged place Reason, obtains the system after described encapsulation and calls.
The real-time CPI acquisition methods of Linux process the most according to claim 1, it is characterised in that described determine with described The process of the real-time CPI index that Linux process is corresponding, including:
The described cpu clock cycle is performed sum divided by described effective instruction, obtains described real-time CPI index.
6. according to the real-time CPI acquisition methods of the Linux process described in any one of claim 1 to 5, it is characterised in that in institute After stating the process determining the real-time CPI index corresponding with described Linux process, also include:
PMU data in linux system is emptied process.
7. the real-time CPI of a Linux process obtains system, it is characterised in that including:
Data obtaining module, for being called by system, is obtained the cpu clock cycle that Linux process is corresponding in real time, and obtains in real time Take described Linux process effective instruction within the described cpu clock cycle and perform sum;
CPI computing module, is used for utilizing described cpu clock cycle and described effective instruction to perform sum, determines and described Linux The real-time CPI index that process is corresponding.
The real-time CPI of Linux process the most according to claim 7 obtains system, it is characterised in that described system call into System after encapsulation is called.
The real-time CPI of Linux process the most according to claim 8 obtains system, it is characterised in that described acquisition of information mould Block includes:
Generating submodule, the system after previously generating described encapsulation is called;
Obtaining submodule, the system after utilize described encapsulation is called, obtain in real time the described cpu clock cycle and described effectively Instruction performs sum.
The real-time CPI of Linux process the most according to claim 9 obtains system, it is characterised in that described generation submodule Block includes:
Pid parameter acquiring unit, is used for obtaining in advance the process pid parameter of described Linux process;
System calls encapsulation unit, for according to described process pid parameter, to the sys_perf_event_ in linux system Open system is called and is packaged processing, and obtains the system after described encapsulation and calls.
11. 1 kinds of Linux process performance judgement systems, it is characterised in that include the reality as described in any one of claim 7 to 10 Time CPI obtain system, also include:
Performance judging module, for utilizing the real-time CPI index obtained in described real-time CPI acquisition system, enters described Linux The performance of journey judges in real time, obtains corresponding process real-time performance information.
CN201610622303.6A 2016-08-01 2016-08-01 A kind of CPI acquisition methods, system and process performance judgement system in real time Pending CN106155865A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610622303.6A CN106155865A (en) 2016-08-01 2016-08-01 A kind of CPI acquisition methods, system and process performance judgement system in real time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610622303.6A CN106155865A (en) 2016-08-01 2016-08-01 A kind of CPI acquisition methods, system and process performance judgement system in real time

Publications (1)

Publication Number Publication Date
CN106155865A true CN106155865A (en) 2016-11-23

Family

ID=57328360

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610622303.6A Pending CN106155865A (en) 2016-08-01 2016-08-01 A kind of CPI acquisition methods, system and process performance judgement system in real time

Country Status (1)

Country Link
CN (1) CN106155865A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1904850A (en) * 2006-08-04 2007-01-31 上海科泰世纪科技有限公司 Method for implementing real-time monitoring performance information of embedded operating system
KR20120064553A (en) * 2010-12-09 2012-06-19 한국전자통신연구원 Method for measuring real-time performance in linux-based embedded system and the system
CN102855171A (en) * 2012-08-09 2013-01-02 浪潮电子信息产业股份有限公司 Consumer price index (CPI) real-time monitoring method based on linux system
US8732675B2 (en) * 2003-06-23 2014-05-20 Broadcom Corporation Operational analysis system for a communication device
CN105740120A (en) * 2014-12-11 2016-07-06 中国科学院软件研究所 Shared memory based real-time monitoring and control method and system for software running process

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8732675B2 (en) * 2003-06-23 2014-05-20 Broadcom Corporation Operational analysis system for a communication device
CN1904850A (en) * 2006-08-04 2007-01-31 上海科泰世纪科技有限公司 Method for implementing real-time monitoring performance information of embedded operating system
KR20120064553A (en) * 2010-12-09 2012-06-19 한국전자통신연구원 Method for measuring real-time performance in linux-based embedded system and the system
CN102855171A (en) * 2012-08-09 2013-01-02 浪潮电子信息产业股份有限公司 Consumer price index (CPI) real-time monitoring method based on linux system
CN105740120A (en) * 2014-12-11 2016-07-06 中国科学院软件研究所 Shared memory based real-time monitoring and control method and system for software running process

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
古木: ""通过perf_event函数获取ipc"", 《HTTP://BLOG.CSDN.NET/A515983690/ARTICLE/DETAILS/51880149》 *
郑纬民等: "《计算机系统结构:一种定量的方法(第二版)》", 31 August 2002, 清华大学出版社 *

Similar Documents

Publication Publication Date Title
Haverkort et al. Model checking performability properties
CN110007957A (en) Call link construction method, device and equipment
CN110210302A (en) Multi-object tracking method, device, computer equipment and storage medium
CN103516912B (en) A kind of mobile terminal location electricity saving method
CN104284057B (en) A kind of method for processing video frequency and device
CN106096391A (en) Process control method and user terminal
CN106789141A (en) A kind of gateway device failure processing method and processing device
CN106155646B (en) Method and device for limiting external application program to call service
US20160316313A1 (en) M2M-based information processing method and M2M service platform
CN109144680A (en) A kind of clock ticktack interrupts setting method and device
CN103530812A (en) Power grid state similarity quantitative analyzing method based on locality sensitive hashing
CN105487971A (en) Method and system for recording and reproducing operation steps in software testing
CN107548087A (en) A kind of method and device of warning association analysis
CN103942135B (en) A kind of method for monitoring performance based on SAP platform
CN104462940A (en) Monitoring method and device for computer USB interface
TW202032395A (en) Data calculation method and engine
CN105554104B (en) According to GPS satellite number bolt down procedure running background method and device
CN106155865A (en) A kind of CPI acquisition methods, system and process performance judgement system in real time
CN109766167A (en) Method, apparatus, system and the equipment of timed task distribution
CN108509255A (en) The treating method and apparatus of hardware interrupts
CN105844179A (en) Terminal protection method and device
CN105868010A (en) Application calling method and terminal
CN103577312B (en) The detection method of the time performance of a kind of software and device
CN109815083A (en) A kind of monitoring method of application crashes, device, electronic equipment and medium
CN105335267A (en) Server temperature prediction method, apparatus and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20161123