Coder Social home page Coder Social logo

stuartshome / qprofiler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from torokernel/qprofiler

0.0 0.0 0.0 238 KB

This repo contains the code of qprofiler which is a tool to profile a guest running on qemu without the need of instrumentation

License: GNU General Public License v2.0

Python 100.00%

qprofiler's Introduction

QProfiler

Introduction

QProfiler stands for QEMU Profiler and is a tool to profile a guest by measuring where the time is spent during its execution. QProfiler samples the cpu registers to count what are the most used functions. The tool does so by relying on the QMP interface. This procedure does not need any instrumentation in the guest.

Example

The repo includes a simple example to profile the appliance HelloWorld which is based on Toro. To try it, you need to clone the repo, install qemu and then execute the following command:

kvm -nographic -vnc :0 -drive format=raw,file=HelloWorld.img -smp 1 -m 256 -qmp unix:./qmp-sock,server,nowait

In a different terminal, execute:

./qprofiler --path=./qmp-sock --duration=10 --frecuency=0.05 --filename=HelloWorld

You will get something like:

96 % of time MOVE at system.pas:1991 has been executed

0 % of time MOVE at system.pas:1990 has been executed

3 % of time WRITE PORTB at Arch.pas:307 has been executed

How to Use

Compile your multiboot kernel with -gl flag to add debug symbols. Then, run qemu by using the -kernel YourKernel option and add -qmp unix:./qmp-sock,server,nowait to redirect qmp to a socket. To lauch qprofile, execute:

./qprofiler --path=./qmp-sock --duration=10 --frecuency=0.05 --filename=YouKernel

The line above tells qpprofiler to test during 10 seconds and to sample Qemu every 0.05 seconds. In addition, the line specifies in path the socket and in filename the binary. If everything worked well after 10 seconds, you are going to get something like:

87 % of time HLT at Arch.pas:1444 has been executed

11 % of time GETAPICID at Arch.pas:411 has been executed

0 % of time GETCURRENTTHREAD at Process.pas:897 has been executed

This represents in which functions the 10 seconds have been elapsed.

Limitations

For the moment, Qprofiler only samples the booting core.

License

GPLv2

qprofiler's People

Contributors

matiasvara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.