PowerSpy: Fine Grained Power Profiler - PowerPoint PPT Presentation

About This Presentation
Title:

PowerSpy: Fine Grained Power Profiler

Description:

Which Thread consumes How much power? What procedures in each thread are invoked? ... Windows Loader Matt Pietrik. www.sysinternals.com. www.osronline.com ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 26
Provided by: defau635
Learn more at: http://web.cs.wpi.edu
Category:

less

Transcript and Presenter's Notes

Title: PowerSpy: Fine Grained Power Profiler


1
PowerSpyFine Grained Power Profiler
  • Kutty S Banerjee
  • Emmanuel Agu

2
Mobile Devices Energy Crisis
  • Rate of Growth of
  • CPU
  • Memory
  • Disk Space
  • Wireless Transfer Speed
  • Far Greater than that of Battery Energy !!

Powerful Change Part1Batteries and Possible
Alternatives for the Mobile Market. IEEE
Pervasive Computing,October-December 2003 (Vol.
2, No. 4)
3
PowerSpy
  • 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?
  • ltApplication initiated I/Ogt

4
PowerSpy Features
  • Non Intrusive of Kernel Source
  • Non Intrusive of Application Source
  • Software-Only
  • Accurate Billing sans OS activities
  • Windows 2000,XP,Server 2003

5
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

6
Thread and I/O Profiling
Thread Power Usage
Device Power Usage
7
Procedural Profiling
8
Application Profiled
  • OpenVRML
  • VRML Browser (disk heavy)
  • Graphics appln.
  • Mozilla
  • I/O heavy (Network heavy)
  • Windows Media Player
  • I/O heavy (Network heavy)

9
Background Work
10
Power Measurement Approaches
  • Measure Power Loss - Application Runtime
  • Hardware (PowerScope)
  • Software (PowerSpy)
  • Break Application Runtime -gtFinite Elements
  • Power Consumption Finitie Elements Known prior
  • Sum to get total power

11
PowerScope Approach
  • Hardware multimeter measures current, voltage.
  • Samples PC, PID, ISR
  • Analysis offline

12
OS Context Switches
  • Time of execution of threadquantum
  • Need to monitor current thread of execution as
    often as quantum period
  • What about preemption? Well see next

System Architecture
13
Scheduler vs KTracker
14
Pseudo Code Algorithm
  • if(measurePowerOn_true)
  • if(currentThread_!SchedulerThread())
  • measurePowerOn_false
  • tempPower_instPower_
  • instPower_measurePower()
  • totalPower_tempPower_-instPower_
  • else
  • if(currentThread_SchedulerThread())
  • measurePowerOn_true
  • instPower_measurePower()

15
I/O Devices (Overlap with CPU)
16
I/O Device Monitor
17
I/O Device Monitor
  • Question -gtDo you check all I/O Devices live in
    system ?
  • Push on stack question until Implementation!!
  • Question -gt What if thread does overlapped I/O
    with n devices?
  • Limitation of PowerSpy. We cannot distinguish b/w
    them!!

18
Overlapped I/O
19
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!!

20
Implementation Overview
21
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 10msroughly equal to
    Windows standard quantum.
  • Every 10ms, DPC preempts Scheduler and executes
    algorithm.
  • 10ms NOT GUARANTEED EXACT!!Windows is NOT REAL
    TIME!!

22
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) -gt
    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

23
Limitations
  • 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!!

24
Reference
  • Inside Windows 2000
  • Programming Applications for MS Windows
  • Windows Loader Matt Pietrik
  • www.sysinternals.com
  • www.osronline.com
  • Powerscope
  • Windows DDK

25
Questions
Write a Comment
User Comments (0)
About PowerShow.com