Coder Social home page Coder Social logo

torokernel / qprofiler Goto Github PK

View Code? Open in Web Editor NEW
29.0 4.0 9.0 244 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 simple 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 --frequency=0.05 --filename=HelloWorld

Note that you have to tell qprofiler the path to the socket previously created by QEMU. You will get something like:

       1 WRITE_PORTB at Arch.pas:303
      18 MOVE at system.pas:1981

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 --frequency=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:

       1 WRITE_PORTB at Arch.pas:303
      18 MOVE at system.pas:1981

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 stuartshome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

qprofiler's Issues

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.