1 / 25

PowerSpy: Fine Grained Power Profiler

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 !!.

rozene
Télécharger la présentation

PowerSpy: Fine Grained Power Profiler

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PowerSpy:Fine 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 Part1:Batteries 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? • <Application initiated I/O>

  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 ->Finite 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 thread=quantum • Need to monitor `current thread of execution’ as often as quantum period • What about preemption? We’ll 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 ->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!!

  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 10ms=roughly 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) -> 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

More Related