Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Intel® RealSense™ Power and Performance Tuning Tips

$
0
0

Interested in tuning your Intel® RealSenseTM Technology application to reduce power consumption, but don't know what tests are worth running? And what do you do with the results? There are multiple tools available to check for high power draw and some that will check for calls that are known to hog power. Info on some of these tools is available in the Resources section of this document.

Or you can just jump in and check for some of these known power consumers.

  1. Don't draw unneeded power.
    - Pause the camera when it’s not needed (see Strategies for Battery-Friendly Intel® RealSense™ Applications).
    - Turn off unused SDK modalities (especially Speech engines). The Intel® RealSenseTM SDK provides a PauseModule function.
    - Only call the specific functions required.(Especially only enable actually used gestures.
    - Use separate threads for different modalities, including within hands or face mode, except for 2 hand gestures.
    - Cache when possible to avoid component lookup overhead. You don't need to create data structures/objects per frame.

    - Set the power state of Intel RealSense SDK modules with PXCPowerState.

  2. Don't peg the CPU nor the GPU. Either can keep the system from entering Turbo Mode which means slower processing. A common causes of high GPU use is excessive rendering. Consider the following:
    - Render close objects first and don't render overlapped objects (Avoid overlapping transparency).
    - Reduce rendering per frame, refresh rates, and  reduce textures on frequently rendered objects.
    - Reduce frame refresh rate, especially at idle (This is also a way to save on monitor power draw.)
    -;Limit floating point calls.
    - Use Direct X* or OpenCL* optimizations.

  3. Don't waste power and time with switching between 32 ad 64 bit libs . 
    Note: Unity* 4 uses 32 bit, Unity 5 uses 64 bit - the SDK defaults to using 32 bit, so you will need to add the 64 bit libraries if using Unity 5. You can use the Personal (free) edition if you add the .signature libraries to your project.

  4. Reduce screen resolution (suggest 1368x768) but be sure to provide scaling.
     
  5. Provide a better user experience through alignment of app and SDK.
    - Cap the App’s FPS rate (30/60). This helps synchronize the app activity with slower RSSDK FPS, (only when camera active).•
    - Don't wait for RSSDK frames.
     
  6. Watch out for waiting.
    Don't use a busy wait loop, but on the other hand, don't use all sleep calls. Instead use the SSE2 Pause API to balance the load between worker threads  and get thread synchronization from mutex/semaphores as well as sleep(0).
    - Use SpinWait WITH pause.

    - Don't poll, use event driven logic.
    - For WaitForSingleObject, use TryEnterCriticalSection WITH spin count).

    - For PeekMessage , add WaitMessage API.
     
  7. Don't mess with the platform timer (or be sure to restore it to default). Consider using timer coalescing.

Here are some indicators of excessive power use that can be found using power and performance analyzers:

  1. Near full utilization of the CPU or GPU (not overall average but repeated peaks during app use).
  2. Non concurrent CPU/GPU use. (Can be seen with Intel Graphics Analyzer (Intel GPA).  Try SetMaximumFrameLatency(1)
  3. During idle, CPU is not entering lower C states. Find out if there's set periodic activity or refreshes keeping them out of idle.
  4. High timer Resolution. Usually the default timer is enough but if need high res timer use QueryPerformanceCounter or the RDTSC API instead of GetXXXTime APIs. Look at the Timer Coalescing.
  5.  Excessive I/O,  IRQ rates >10k/second.
  6. Context switching > 7k/active thread. Try reducing the # active threads, add more balancing, reduce waits.
  7. Systems class calls >45k/active thread. Look at timer rez and driver calls (including RealSense DCM).
  8. NTDelayExecution in ring 0 (context switching).
  9. DirectX apps that are always animating might need to process input on another thread to get the best input latency. Consider using waitable swap chains and disabling touch visualizations to get additional input latency savings.

Resources:

Excellent articles:Power Analysis Guide for Windows & 
                               Strategies for Battery-Friendly Intel® RealSense™ Applications

Additional Info:
Developing Green Software
Developing Power-aware Apps
Intel® RealSense website on Intel® Developer Zone

Tool Downloads:


Viewing all articles
Browse latest Browse all 3384

Trending Articles