DSP

Qualcomm Symphony System Manager SDK使用举例

2019-07-13 18:48发布

Qualcomm Symphony System Manager SDK使用举例         Symphony System Manager是Qualcomm的产品,提供整体的CPU、GPU和DSP功率与性能管理,让程序能够在低功耗、低散热的严格要求下,以稳定的帧数率运行。此SDK为应用程序提供可调用的接口和相应的动态库文件。         下载和安装         https://developer.qualcomm.com/download/software
        把下载后的文件libsymphony-1.1.0.deb放在任意目录下,解压:         #dpkg -x libsymphony-1.1.0.deb symphony-1.1.0         目录symphony-1.1.0即是我们需要的文件,其主要内容如下:       
       本文之讲解android环境上的使用,我们只关注arm-linux-androideabi目录。
        使用举例         1.搭建工程环境
               # mkdir project_symphony            # cd project_symphony            # mkdir jni            # cd jni
           # cp -r /opt/Qualcomm/Symphony/1.1.0/arm-linux-androideabi/include ./            # cp -r /opt/Qualcomm/Symphony/1.1.0/arm-linux-androideabi/lib ./            # vim Application.mk            内容如下: APP_STL := gnustl_static APP_ABI := armeabi-v7a NDK_TOOLCHAIN_VERSION := 4.9 #set the APP_PLATFORM to match your platform version. APP_PLATFORM := android-18          # vim Android.mk
         内容如下: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) SYMPHONY_VERSION := 1.1.0 SYMPHONY_LIB_TYPE := release-cpu include $(LOCAL_PATH)/lib/SYMPHONY.mk        工程目录下的目录文件包括: Android.mk、Application.mk、include和lib;
       2.验证环境         执行ndk交叉编译(请安装crystax-ndk并配置环境变量)
        # ndk-build
        如下,则环境配置成功:
        3.举例代码
             # vim pfor_helloworld.cc
             源码如下:
#include #include int main() { // initialize the input vector std::vector vin(1024, 0); // in-place update of the input vector // equivalent to the following code // for (size_t i = 0; i < vin.size(); ++i) { // vin[i] = 2 * i; // } symphony::pfor_each(size_t(0), vin.size(), [&vin](size_t i) { vin[i] = 2 * i; }); return 0; }         # vim Android.mk        添加后的代码如下: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) SYMPHONY_VERSION := 1.1.0 SYMPHONY_LIB_TYPE := release-cpu include $(LOCAL_PATH)/lib/SYMPHONY.mk ################################################ include $(CLEAR_VARS) LOCAL_ARM_MODE := arm ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) LOCAL_ARM_NEON := true endif LOCAL_MODULE := pfor_helloworld LOCAL_CPP_FEATURES := exceptions LOCAL_SHARED_LIBRARIES := libsymphony LOCAL_SRC_FILES := pfor_helloworld.cc include $(BUILD_EXECUTABLE)         4. 编译代码
         # ndk-build          输出如下,则编译成功: