CN105630651A - Method and device for monitoring performance - Google Patents

Method and device for monitoring performance Download PDF

Info

Publication number
CN105630651A
CN105630651A CN201510998421.2A CN201510998421A CN105630651A CN 105630651 A CN105630651 A CN 105630651A CN 201510998421 A CN201510998421 A CN 201510998421A CN 105630651 A CN105630651 A CN 105630651A
Authority
CN
China
Prior art keywords
function
machine code
script
internal memory
supervision
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
CN201510998421.2A
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.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology 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 Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN201510998421.2A priority Critical patent/CN105630651A/en
Publication of CN105630651A publication Critical patent/CN105630651A/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

Landscapes

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

Abstract

The invention provides a method and device for monitoring performance. According to the method and device for monitoring the performance, a monitoring script is compiled aiming at a function, when the function is called, the function is not directly called, and the monitoring script of the function is firstly called to start monitoring on the function; after the monitoring script is called, the function continues to be called, and monitoring on the function is achieved. Due to the fact that the function is used for describing the performance, it is equivalent that performance monitoring is achieved. By means of monitoring, the problem causing a performance bottleneck can be fast located, and efficiency is greatly improved.

Description

Performance monitoring method and device
Technical field
The application relates to computer technology, in particular to performance monitoring method and device.
Background technology
In large-scale program development process; usually can run into some performance bottlenecks; such as when height is concurrent; produce process failure as: database connection pool is too low; server linking number exceedes the upper limit; Database lock control is considered not enough etc.), RAM leakage as, under long-play, internal memory does not normally discharge, machines of delaying etc., CPU use deviation as high concurrent caused that CPU rate of utilization is too high, how etc. daily record printed.
For ensureing carrying out smoothly of program development, it is necessary to orient rapidly the reason producing performance bottleneck, to improve the efficiency of program development.
Summary of the invention
This application provides performance monitoring method and device, monitor performance to realize by customizing method, quick position goes out to affect the factor of performance.
The technical scheme that the application provides comprises:
A kind of performance monitoring method, the method comprises:
Determine the function that the needs that user chooses monitor;
The supervision utilizing described function corresponding requires to write supervision script;
When calling described function, first call described supervision script, when described supervision script is called complete, continue to call described function.
A kind of performance monitor apparatus, this device comprises:
Determining unit, for determining the function that the needs that user chooses monitor;
Script unit, writes supervision script for utilizing the supervision that described function is corresponding to require;
Control unit, for when calling described function, first calling described supervision script, when described supervision script is called complete, continues to call described function.
As can be seen from the above technical solutions, in the present invention, by writing supervision script for function, when calling function, and non-immediate calls function, but first call the supervision script of function, to open the supervision of function, afterwards, when monitoring that script is called complete, continue to call function, namely achieve the supervision of function, because function describes performance, also just be equivalent to achieve the supervision of performance. By this supervision, it is possible to quick position goes out to cause the problem of performance bottleneck, and efficiency improves greatly.
Accompanying drawing explanation
Fig. 1 is method flow diagram provided by the invention;
Fig. 2 a is the schematic diagram that prior art calls function;
Fig. 2 b is the schematic diagram calling function in the present invention;
The method flow diagram that Fig. 3 provides for the embodiment of the present invention;
Fig. 4 is apparatus structure schematic diagram provided by the invention.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearly, describe the present invention below in conjunction with the drawings and specific embodiments.
Method provided by the invention comprises the flow process shown in Fig. 1:
It is schema provided by the invention see Fig. 1, Fig. 1. As shown in Figure 1, this flow process can comprise the following steps:
Step 101, it is determined that the function that the needs that user chooses monitor.
As one embodiment of the present of invention, in windows Application and Development environment, step 101 determines that the function that the needs that user chooses monitor can comprise:
From program database (pdb:programdDatabase) file (file), read all functions be supplied to user;
Determine the function that the needs that user chooses from the function being provided monitor.
Step 102, the supervision utilizing described function corresponding requires to write supervision script.
This supervision script describes the supervision requirement that function is corresponding, such as monitors number of times that function is run, time etc.
Step 103, when calling described function, first calls described supervision script, when described supervision script is called complete, continues to call described function.
As can be seen from step 103, when calling function, and non-immediate calls function, but first call the supervision script of function, to open the supervision of function, afterwards, when monitoring that script is called complete, continuing to call function, Fig. 2 a to Fig. 2 b respectively illustrates prior art and the present invention schematic diagram when program calls function. Because function describes performance, so, in the present invention, the supervision of function also just is equivalent to achieve the supervision of performance, namely present invention achieves performance and monitors.
So far, complete the flow process shown in Fig. 1.
By the flow process shown in Fig. 1 it may be seen that in the present invention, by writing supervision script for function, when calling function, and non-immediate calls function, but first call the supervision script of function, to open the supervision of function, afterwards, when monitoring that script is called complete, continue to call function, namely achieve the supervision of function, because function describes performance, also just be equivalent to achieve the supervision of performance. By this supervision, it is possible to quick position goes out to cause the problem of performance bottleneck, and efficiency improves greatly.
Below by a specific embodiment, flow process shown in Fig. 1 is described:
It is embodiment schema provided by the invention see Fig. 3, Fig. 3. As shown in Figure 3, this flow process can comprise the following steps:
Step 301, reads all functions from pdb file and is supplied to user.
Specifically, step 301 is: reads the symbol containing this keyword from pdb file with the keyword that is designated of function and is supplied to user.
Step 302, it is determined that the function (here for function a) that the needs that user chooses from the function being provided monitor.
It should be noted that, in the present invention, function a is a general reference function just, does not specifically limit a certain function.
Step 303, the supervision utilizing function a corresponding requires to write supervision script.
As mentioned above, it is necessary, function, it describes performance, it is evident that it also has certain performance requriements, and based on this, in step 303, the supervision utilizing function a corresponding requires to write and monitors that script is specially:
The performance requriements corresponding to performance utilizing function a to describe writes supervision script.
Step 304, becomes machine code by supervision script compile.
Specifically, in step 304, by script compile device, supervision script compile is become machine code.
When monitoring that script compile becomes machine code, its execution efficiency when the performance that supervision function in real time is corresponding is very high, and almost can not increase any burden for original program.
Step 305, distributes one piece of internal memory in process to be monitored, and machine code step 304 compiled writes in this internal memory.
Step 306, when calling function a, first jumps to internal memory and performs the machine code in internal memory, and to realize the execution of described supervision script, after the machine code in internal memory is finished, redirect performs function a.
Step 306 first calls described supervision script in above-mentioned steps 103, when described supervision script is called complete, continues to call a specific implementation of described function.
Within step 306, jump to the machine code that internal memory performs in described internal memory to comprise:
Beginning at function adds the first redirect (jmp) assembly instruction, to jump to the machine code that described internal memory performs in described internal memory.
Here, the first redirect assembly instruction can comprise the address information of internal memory, based on this address information, then can conveniently jump to the machine code that internal memory performs in described internal memory.
In the present invention, after the machine code for ensureing in step 306 in internal memory is finished, redirect performs function, can comprise further:
Finally add the 2nd jmp assembly instruction at machine code, perform function a with redirect;
Here, the 2nd jmp assembly instruction can comprise the address information of function a, based on this address information, then can conveniently jump to function a.
Based on this, in step 306, after the machine code in internal memory is finished, redirect performs function a and comprises:
Function a is performed according to the 2nd jmp assembly instruction redirect of machine code in the internal memory performed. Here, when the 2nd jmp assembly instruction of machine code in the internal memory performed, it is meant that the machine code in internal memory is finished.
So far, complete the flow process shown in Fig. 3.
Can be found out by the flow process shown in Fig. 3, in the present invention, the supervision script compile write for function is become machine code, can performance corresponding to Real-Time Monitoring function by this machine code, reach the object of Real-Time Monitoring performance, and, can orient, according to this performance Real-Time Monitoring, the source causing performance bottleneck in time when performance bottleneck, quick position goes out to affect the factor of performance, it is to increase program operational efficiency.
Above method provided by the invention is described, below device provided by the invention is described:
It is structure drawing of device provided by the invention see Fig. 4, Fig. 4. As shown in Figure 4, this device comprises:
Determining unit, for determining the function that the needs that user chooses monitor;
Script unit, writes supervision script for utilizing the supervision that described function is corresponding to require;
Control unit, for when calling described function, first calling described supervision script, when described supervision script is called complete, continues to call described function.
Preferably, described determining unit determines, by following step, the function that the needs that user chooses monitor:
From pdb file, read all functions be supplied to user;
Determine the function that the needs that user chooses from the function being provided monitor.
Preferably, described script unit is after utilizing the supervision that described function is corresponding to require to write and monitoring script, and before described function is called, performs following step further:
Described supervision script compile is become machine code;
In process to be monitored, distribute one piece of internal memory, described machine code is write in described internal memory;
Based on this, described control unit realizes first calling described supervision script by following step, when described supervision script is called complete, continues to call described function:
Jump to the machine code that described internal memory performs in described internal memory, to realize the execution of described supervision script;
After the machine code in described internal memory is finished, redirect performs described function.
Preferably, described control unit jumps to the machine code that described internal memory performs in described internal memory and comprises:
Beginning at described function adds the first redirect jmp assembly instruction, to jump to the machine code that described internal memory performs in described internal memory;
Preferably, described script unit finally adds the 2nd jmp assembly instruction at described machine code further, performs described function with redirect;
Based on this, described control unit is realized after the machine code in described internal memory is finished by following step, and redirect performs described function:
Described function is performed according to the 2nd jmp assembly instruction redirect of described machine code.
Preferably, described control unit adds the first redirect jmp assembly instruction in the beginning of function and comprises:
The hook using inline inline to link up with in hook adds the first redirect jmp assembly instruction in the beginning of described function;
Preferably, described script unit comprises in the 2nd jmp assembly instruction that finally adds of described machine code:
Use inline inline to link up with the hook in hook and finally add the 2nd jmp assembly instruction at described machine code.
So far, complete the structure drawing of device shown in Fig. 4.
The foregoing is only the better embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment of making, equivalent replacement, improvement etc., all should be included within the scope of protection of the invention.

Claims (10)

1. a performance monitoring method, it is characterised in that, the method comprises:
Determine the function that the needs that user chooses monitor;
The supervision utilizing described function corresponding requires to write supervision script;
When calling described function, first call described supervision script, when described supervision script is called complete, continue to call described function.
2. method according to claim 1, it is characterised in that, the function that the needs that the described user of determination chooses monitor comprises:
From program database pdb file, read all functions be supplied to user;
Determine the function that the needs that user chooses from the function being provided monitor.
3. method according to claim 1, it is characterised in that, after utilizing the supervision that described function is corresponding to require to write and monitoring script, and before calling described function, comprise further:
Described supervision script compile is become machine code;
In process to be monitored, distribute one piece of internal memory, described machine code is write in described internal memory;
Described first call supervision script, when monitoring that script is called complete, continue to call function and comprise:
Jump to the machine code that described internal memory performs in described internal memory, to realize the execution of described supervision script;
After the machine code in described internal memory is finished, redirect performs described function.
4. method according to claim 3, it is characterised in that, described in jump to the machine code that internal memory performs in internal memory and comprise:
Beginning at described function adds the first redirect jmp assembly instruction, to jump to the machine code that described internal memory performs in described internal memory;
The method comprises further:
Finally add the 2nd jmp assembly instruction at described machine code, perform described function with redirect;
Described after the machine code in internal memory is finished, redirect performs described function and comprises:
Described function is performed according to the 2nd jmp assembly instruction redirect of described machine code.
5. method according to claim 4, it is characterised in that, the described beginning at function adds the first redirect jmp assembly instruction and comprises:
The hook using inline inline to link up with in hook adds the first redirect jmp assembly instruction in the beginning of described function;
Described the 2nd jmp assembly instruction that finally adds at machine code comprises:
Use inline inline to link up with the hook in hook and finally add the 2nd jmp assembly instruction at described machine code.
6. a performance monitor apparatus, it is characterised in that, this device comprises:
Determining unit, for determining the function that the needs that user chooses monitor;
Script unit, writes supervision script for utilizing the supervision that described function is corresponding to require;
Control unit, for when calling described function, first calling described supervision script, when described supervision script is called complete, continues to call described function.
7. device according to claim 6, it is characterised in that, described determining unit determines, by following step, the function that the needs that user chooses monitor:
From program database pdb file, read all functions be supplied to user;
Determine the function that the needs that user chooses from the function being provided monitor.
8. device according to claim 6, it is characterised in that, described script unit is after utilizing the supervision that described function is corresponding to require to write and monitoring script, and before described function is called, performs following step further:
Described supervision script compile is become machine code;
In process to be monitored, distribute one piece of internal memory, described machine code is write in described internal memory;
Described control unit realizes first calling described supervision script by following step, when described supervision script is called complete, continues to call described function:
Jump to the machine code that described internal memory performs in described internal memory, to realize the execution of described supervision script;
After the machine code in described internal memory is finished, redirect performs described function.
9. device according to claim 8, it is characterised in that, described control unit jumps to the machine code that described internal memory performs in described internal memory and comprises:
Beginning at described function adds the first redirect jmp assembly instruction, to jump to the machine code that described internal memory performs in described internal memory;
Described script unit finally adds the 2nd jmp assembly instruction at described machine code further, performs described function with redirect;
Described control unit is realized after the machine code in described internal memory is finished by following step, and redirect performs described function:
Described function is performed according to the 2nd jmp assembly instruction redirect of described machine code.
10. device according to claim 9, it is characterised in that, described control unit adds the first redirect jmp assembly instruction in the beginning of function and comprises:
The hook using inline inline to link up with in hook adds the first redirect jmp assembly instruction in the beginning of described function;
Described script unit comprises in the 2nd jmp assembly instruction that finally adds of described machine code:
Use inline inline to link up with the hook in hook and finally add the 2nd jmp assembly instruction at described machine code.
CN201510998421.2A 2015-12-28 2015-12-28 Method and device for monitoring performance Pending CN105630651A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510998421.2A CN105630651A (en) 2015-12-28 2015-12-28 Method and device for monitoring performance

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510998421.2A CN105630651A (en) 2015-12-28 2015-12-28 Method and device for monitoring performance

Publications (1)

Publication Number Publication Date
CN105630651A true CN105630651A (en) 2016-06-01

Family

ID=56045624

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510998421.2A Pending CN105630651A (en) 2015-12-28 2015-12-28 Method and device for monitoring performance

Country Status (1)

Country Link
CN (1) CN105630651A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7143396B2 (en) * 2002-11-06 2006-11-28 Sun Microsystems, Inc. System and method for measuring code segment performance
CN101477491A (en) * 2009-01-16 2009-07-08 杭州华三通信技术有限公司 Method and apparatus for function running state statistics
CN101620562A (en) * 2009-08-07 2010-01-06 中兴通讯股份有限公司 Method and system for estimating property of embedded type system
CN103365931A (en) * 2012-04-10 2013-10-23 中兴通讯股份有限公司 Method and device for recording quick positioning function performances in performance analysis tool
CN104598809A (en) * 2015-02-13 2015-05-06 北京奇虎科技有限公司 Program monitoring method and defending method thereof, as well as relevant device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7143396B2 (en) * 2002-11-06 2006-11-28 Sun Microsystems, Inc. System and method for measuring code segment performance
CN101477491A (en) * 2009-01-16 2009-07-08 杭州华三通信技术有限公司 Method and apparatus for function running state statistics
CN101620562A (en) * 2009-08-07 2010-01-06 中兴通讯股份有限公司 Method and system for estimating property of embedded type system
CN103365931A (en) * 2012-04-10 2013-10-23 中兴通讯股份有限公司 Method and device for recording quick positioning function performances in performance analysis tool
CN104598809A (en) * 2015-02-13 2015-05-06 北京奇虎科技有限公司 Program monitoring method and defending method thereof, as well as relevant device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
徐君明: "《嵌入式硬件设计 第2版》", 31 October 2007 *
朱岩: "《工业用微型计算机》", 31 March 2011 *

Similar Documents

Publication Publication Date Title
US8990780B2 (en) Setting breakpoints in optimized instructions
CN101446918B (en) Method for realizing debugging of single function by user state debugger and system thereof
CN102955737B (en) The program debugging method of heterogeneous processor system and system
CN106021257A (en) Method, device, and system for crawler to capture data supporting online programming
CN104462943B (en) Non-intrusion type performance monitoring apparatus and method in operation system
WO2016095570A1 (en) Debugging method and apparatus for embedded system, and storage medium
CN111444065B (en) AspectJ-based mobile terminal performance index monitoring method
CN108319555A (en) A kind of real-time adjustment method based on embedded real time system
CN108809755B (en) Automatic testing method and system for home gateway compatible with command line and WEB interface
CN103077111A (en) Method and system for locating continuous integration failed case
US20120079459A1 (en) Tracing multiple threads via breakpoints
CN103678135A (en) System and method for achieving cross-process and cross-thread debugging in large-data environment
CN105528231A (en) Intermediate auxiliary function-based method and intermediate auxiliary function-based system for dynamically updating software
US9117020B2 (en) Determining control flow divergence due to variable value difference
CN105739992B (en) The method and system of software control memory partition and mapping based on GCC compiler
CN110046100B (en) Packet testing method, electronic device and medium
CN107526622A (en) Rapid exception handling method and device for Linux
CN103309741B (en) Call the method and apparatus of pin function
CN108255735A (en) Associated environment test method, electronic device and computer readable storage medium
WO2021244088A1 (en) Program control method and apparatus, and computer device and storage medium
CN105787371A (en) Method and system for monitoring computer process
CN110851123A (en) WebGIS power grid visualization framework construction method, system and device based on SpringMVC
CN101149700B (en) Method for implementing order display through configuration files
WO2017202083A1 (en) Microcode debugging method and single board
CN105630651A (en) Method and device for monitoring performance

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: 20160601