Using prebuilt binaries

The Profiling Helper Tool plugin package contains prebuilt Win64 and Android framework binaries that you can use to integrate the plugin with your application without compiling Profiling Helper Tool source code.

When using prebuilt binaries, Profiling Helper Tool does not extract startup profiling data. See Startup profiling.

Using prebuilt binaries with an existing application executable on Windows

You can integrate Profiling Helper Tool binaries to an existing application executable. When doing this, you do not need to recompile the application.

To use prebuilt Profiling Helper Tool binaries with an existing application executable:

  1. Copy the ProfilingHelper.dll binary that matches the build tool version and configuration used to compile your application to the <ProjectFolder>/Application/bin directory.

    For example, if the application is built using the Visual Studio 2019 compiler and Profiling configuration, use ProfilingHelper.dll from the profilinghelper/lib/GL_vs2019_Profiling_DLL directory.

  2. In <ProjectFolder>/Application/bin/application.cfg, add ProfilingHelper to the ModuleNames configuration option. See ModuleNames application configuration option.

    ModuleNames = "ProfilingHelper"
    
  3. When you launch the application, profiling results are stored in <ProjectFolder>/Application/bin/tracing_output.json. To configure Profiling Helper Tool, see Configuring Profiling Helper Tool.

Using prebuilt binaries with an existing Visual Studio solution

To use prebuilt Profiling Helper Tool binaries with an existing Visual Studio solution:

  1. Open the CMakeLists.txt file of your application and add prebuilt binaries to the Visual Studio working environment:

    set(BUILD_OUTPUT_FOLDER_NAME "GL_${MSVC_VERSION_TAG}_$<CONFIG>_DLL")
    set_target_properties(ApplicationTest PROPERTIES VS_DEBUGGER_ENVIRONMENT "${KANZI_VS_DEBUGGER_ENVIRONMENT};$ENV{KANZI_HOME}/Engine/plugins/profilinghelper/lib/Win64/${BUILD_OUTPUT_FOLDER_NAME}")
    
  2. In <ProjectFolder>/Application/bin/application.cfg, enable all profilers and add ProfilingHelper to the ModuleNames configuration option. See ModuleNames application configuration option.

    # Enables all performance profiling categories.
    ProfilingCategoryFilter="*=on"
    ModuleNames = "ProfilingHelper"
    
  3. When you launch the application, profiling results are stored in <ProjectFolder>/Application/bin/tracing_output.json. To configure Profiling Helper Tool, see Configuring Profiling Helper Tool.

Using prebuilt binaries with an existing Android application

You can use the prebuild Android binaries of Profiling Helper Tool with Android applications based on Android framework or Android with the Kanzi application framework.

  1. In the application.cfg file of your application, enable all profilers and add the ProfilingHelper to the list of modules.

    Enabling the profilers does not affect application performance of the Debug or Release builds, because profiling measurements are performed only in the Profiling build.

    # Enables all performance profiling categories.
    ProfilingCategoryFilter="*=on"
    ModuleNames = "ProfilingHelper"
    
  2. To save the profiling data to the filesystem, in the Application/configs/platforms/android_gradle/app/src/main/AndroidManifest.xml, enable the read and write permission.

    • For Android SDK version 30 and newer:

      <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
      
    • For Android SDK version older than 30:

      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
      
  3. Create a pop-up when the application starts where you ask for file system access permission. Android requires users to confirm permission requests. This approach makes it easier to enable permissions than it is to do so manually in the application settings.

    1. In the Java file that contains the main activity of your application, add the requestReadWritePermissions function.

      • For Android SDK version 30 and newer:

        void requestReadWritePermissions() {
           // Check and request permission to read and write to external storage.
           // Android SDK 30 and above requires MANAGE_EXTERNAL_STORAGE.
           if(SDK_INT >= Build.VERSION_CODES.R) {
              if (!Environment.isExternalStorageManager()) {
                    Uri uri = Uri.parse("package:" + BuildConfig.APPLICATION_ID);
                    Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, uri);
                    startActivity(intent);
              }
           }
        }
        
      • For Android SDK version older than 30:

        void requestReadWritePermissions() {
           // Check and request permission to read and write to external storage.
           // Android SDK 30 and above requires WRITE_EXTERNAL_STORAGE.
           if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
              if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
                    ||checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                 ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
              }
           }
        }
        
    2. Call the requestReadWritePermissions function in the onCreate function of your activity.

      @Override
      protected void onCreate(Bundle icicle) {
      
         // Request the permissions.
         requestReadWritePermissions();
      
  4. In Android Studio, set the build configuration to Profiling.

    This way you enable Kanzi Engine to collect profiling data at runtime.

    On Kanzi Android framework, Profiling Helper Tool by default outputs profiling results to the sdcard directory.

    _images/droidfw-change-config-to-profiling.png
  5. In Android Studio, add Profiling Helper Tool binaries to dependencies section in the build.gradle file of the application.

    dependencies {
    
       debugImplementation      files(getKanzi().toString() + '/Engine/plugins/profilinghelper/lib/android/profilinghelperplugin-debug.aar')
       profilingImplementation  files(getKanzi().toString() + '/Engine/plugins/profilinghelper/lib/android/profilinghelperplugin-profiling.aar')
       releaseImplementation    files(getKanzi().toString() + '/Engine/plugins/profilinghelper/lib/android/profilinghelperplugin-release.aar')
    

See also

Getting started with Profiling Helper Tool