Powerspy fine grained power profiler
1 / 25

PowerSpy: Fine Grained Power Profiler - PowerPoint PPT Presentation

  • Uploaded on

PowerSpy: Fine Grained Power Profiler. Kutty S Banerjee Emmanuel Agu. Mobile Devices – Energy Crisis. Rate of Growth of CPU Memory Disk Space Wireless Transfer Speed Far Greater than that of Battery Energy !!.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' PowerSpy: Fine Grained Power Profiler' - rozene

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Powerspy fine grained power profiler

PowerSpy:Fine Grained Power Profiler

Kutty S Banerjee

Emmanuel Agu

Mobile devices energy crisis
Mobile Devices – Energy Crisis

  • Rate of Growth of

    • CPU

    • Memory

    • Disk Space

    • Wireless Transfer Speed

      Far Greater than that of Battery Energy !!

Powerful Change Part1:Batteries and Possible Alternatives for the Mobile Market. IEEE Pervasive Computing,October-December 2003 (Vol. 2, No. 4)


Helps answer the following questions:

  • Which Thread consumes How much power?

  • What procedures in each thread are invoked?

  • Which I/O Device consumes how much power?

    • <Application initiated I/O>

Powerspy features
PowerSpy Features:

  • Non Intrusive of Kernel Source

  • Non Intrusive of Application Source

  • `Software-Only’

  • Accurate Billing sans OS activities

  • Windows 2000,XP,Server 2003

Powerspy usage
PowerSpy Usage

  • Installation:

    • Powerspy.sys (kernel mode driver)

      • Installation Requires Administrative Privilege

    • Powerspy.exe (user mode application)

    • Windows XP (run checked build)

      • Boot option `/debug’ flag set

  • Usage:

    • powerspy devenv.exe (Microsoft Visual Studio)

    • Produces `report.dat’ . Results next…

Thread and i o profiling
Thread and I/O Profiling

Thread Power Usage

Device Power Usage

Application profiled
Application Profiled

  • OpenVRML

    • VRML Browser (disk heavy)

    • Graphics appln.

  • Mozilla

    • I/O heavy (Network heavy)

  • Windows Media Player

    • I/O heavy (Network heavy)

Power measurement approaches
Power Measurement Approaches

  • Measure Power Loss - Application Runtime

    • Hardware (PowerScope)

    • Software (PowerSpy)

  • Break Application Runtime ->Finite Elements

    • Power Consumption Finitie Elements Known prior

    • Sum to get total power

Powerscope approach
PowerScope Approach

  • Hardware multimeter measures current, voltage.

  • Samples PC, PID, ISR

  • Analysis offline

Os context switches
OS Context Switches

  • Time of execution of thread=quantum

  • Need to monitor `current thread of execution’ as often as quantum period

  • What about preemption? We’ll see next…

System Architecture

Pseudo code algorithm
Pseudo Code Algorithm

















I o device monitor1
I/O Device Monitor

  • Question ->Do you check all I/O Devices live in system ?

    • Push on stack question until Implementation!!

  • Question -> What if thread does overlapped I/O with `n’ devices?

    • Limitation of PowerSpy. We cannot distinguish b/w them!!

What about procedures
What about Procedures?

  • Two Approaches?

    • Invasive – Add stub of code in executable in each procedure for all modules

      • Stub merely records itself!!

    • NonInvasive – Simply check PC at sampled intervals. (POWERSPY APPROACH)

      • Use Module Export/Import Table

      • Base Loading Address

        For address to module,procedure translation!!

Windows scheduling policy
Windows Scheduling Policy

  • Preemptive Priority driven.

  • Get current thread running (last running) PsGetCurrentThreadId (kernel mode call)

  • To monitor Scheduler

    • Need to be at same priority

    • Must be non preemptable by Scheduler

    • DPC (Deferred Procedure Calls) execute at same priority as Windows Scheduler called `Dispatcher’

    • Timed DPC running at 10ms=roughly equal to Windows standard quantum.

    • Every 10ms, DPC preempts Scheduler and executes algorithm.


Monitor i o operations
Monitor I/O Operations

  • All user mode appln do I/O by Win32 API

  • Win32 API forwards request to I/O Manager

  • I/O Manager creates IRP (I/O Request Packet) and forwards to appropriate Device Driver.

  • For every thread( user mode or kernel mode), internal OS data structure (undocumented) -> ETHREAD.

  • ETHREAD contains list of IRPs thread currently blocked on.

  • IRP contains name of I/O Devices.

  • Therefore, thread to I/O Device located!!

  • ETHREAD maintained in `ntoskrnl.exe’. Not Exported!! Therefore need `debug symbols’. Hence need to run `checked build of Windows’.

  • Have access to Internet!! Symbol Server of Microsoft at http://msdl.microsoft.com


  • Thread Blocked on I/O Device DOES NOT mean I/O Device currently executing its order!!

  • I/O Device has internal queue.

  • Thread 4 blocked and billed but not actually serviced!! Excess Power billed!!

  • Procedures NOT CALL GRAPH!!


  • Inside Windows 2000

  • Programming Applications for MS Windows

  • Windows Loader – Matt Pietrik

  • www.sysinternals.com

  • www.osronline.com

  • Powerscope

  • Windows DDK