Skip to content

Commit

Permalink
Added enhancements
Browse files Browse the repository at this point in the history
Added probes for opencl, igcrcl
Separated i915 probes into it's own file
Updted set_probes_csv to append libname to probes

Signed-off-by: Arshad Mehmood <[email protected]>
  • Loading branch information
arshadlab committed Dec 25, 2024
1 parent d221393 commit 56a13d6
Show file tree
Hide file tree
Showing 10 changed files with 400 additions and 38 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Bash Scripting Meets Performance Analysis:
## BashfulProfiler for Linux application and Kernel

Introducing BashfulProfiler: a robust, non-intrusive, and highly adaptable bash-based performance analysis tool. Its main goal is to provide developers with flexible and detailed insights into the performance characteristics of their Linux-based applications. All you need is Linux perf tool support on your system and, preferably, symbol-built (e.g., -g) target binaries, whether executables or dynamic libraries.
Introducing BashfulProfiler: a robust, non-intrusive, and highly adaptable bash-based performance analysis tool. Its main goal is to provide developers with flexible and detailed insights into the performance characteristics of their Linux-based applications. All you need is Linux perf tool support on your system and, preferably, symbol-built (e.g., -g) target binaries, whether executables or dynamic libraries. This implementation has been tested on Ubuntu 2022 and 2024 with Python 3.10 or Python 3.12. Although it primarily involves bash scripts, the third-party tools used rely on Python.

## Overview
The tool's design is split into two main components: the front end, built entirely using bash scripting, and the backend, which relies on the Linux Kernel Perf tool, ctf2ctf, trace2html and flamegraph. Probes or traces are defined in a configuration file (for instance, probes.csv), which are then parsed and passed to the Perf tool to set up the probes. Once set, a capturing script proceeds to record these probes over a predetermined duration (such as 8 seconds). After the recording phase, the captured data is processed and transformed into easily understandable time charts and flamegraphs, offering clear insights for performance analysis. The probe setting is done once for that boot session however capture can be done multiple times depending on run configuratins and needs.
Expand Down Expand Up @@ -167,7 +167,7 @@ cd time_charting_with_perf
./setup_dependency.sh
```

##### Setup probes
##### Setup probes using csv

It's important to initiate Gazebo or the target process before setting up the probes. This is because the probes, as defined in the probe.csv file, rely on running target process in order to determine the absolute locations of the .so files within the system. However, if probe.csv file contains the full paths to the .so files, running the target process prior to setting up the probes is not necessary.
```
Expand Down Expand Up @@ -196,8 +196,15 @@ You can now use it in all perf tools, such as:
```

##### Setup probes using lib

Setting up probes is generally a one-time process, unless your system undergoes a reboot or the target binary is modified or updated. Once these probes are properly configured, you can conduct multiple capture sessions without needing to set them up again. Thus, the configuration persists across various capture sessions, offering you the flexibility to perform repeated analyses with ease.
Probes can also be set directly on .so files. Use the set_probes_lib.sh script with an optional filter to set probes. If no filter is provided, probes will be added to all exported symbols. Initially, publicly available symbols will be searched (e.g., using -T), and if no symbol is found, debug symbols will be searched (e.g., using -t).

```
$ ./scripts/set_probes_lib.sh /usr/lib/x86_64-linux-gnu/intel-opencl/libigdrcl.so
```

Setting up probes is generally a one-time process, unless your system undergoes a reboot or the target binary is modified or updated. New probes are appended to existing list and if the same probe is added again then it's overwritten. Once these probes are properly configured, you can conduct multiple capture sessions without needing to set them up again. Thus, the configuration persists across various capture sessions, offering you the flexibility to perform repeated analyses with ease.

##### Start Capturing

Expand All @@ -221,3 +228,4 @@ Once established, probes will remain created (but not active) until a system reb
## Troubleshoot
If there are an excessive number of trace samples, loading the .html file in the browser might become problematic. In such situations, you have two options: either reduce the number of trace probes or decrease the capture duration to reduce the overall size of the captured samples.

Probe names have a length limit. If you encounter issues while setting probes, try reducing the length of the probe names in the .csv file.
12 changes: 12 additions & 0 deletions probes/i915.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#, Header: ".so name","process name","symbol filter","probe name"
#, No space before and after commas
#, Openvino library with debug symbol included
#, set_probes_csv.sh will look into the given process to find library path from loaded .so files
#, If absolute path is given then process name is ignored.
#, Below probes assume openvino plugins are compiled with debug symbols included (e.g -g).

# Kernel mode driver. i915.ko
i915.ko,,\bi915_gem_do_execbuffer,i915_gem_do_execbuffer
i915.ko,,\bii915_gem_wait_ioctl,i915_gem_wait_ioctl
i915.ko,,\bi915_request_wait_timeout,i915_request_wait_timeout
i915.ko,,\bflush_submission,flush_submission
130 changes: 130 additions & 0 deletions probes/igdrcl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#, Header: ".so name","process name","symbol filter","probe name"
#, No space before and after commas
#, Openvino library with debug symbol included
#, set_probes_csv.sh will look into the given process to find library path from loaded .so files
#, If absolute path is given then process name is ignored.
#, Below probes assume openvino plugins are compiled with debug symbols included (e.g -g).

libigdrcl.so,benchmark,clCreateImage3D,clCreateImage3D
,,clSetProgramReleaseCallback,clSetProgramReleaseCallback
,,clCreateAcceleratorINTEL,clCreateAcceleratorINTEL
,,clGetDeviceInfo,clGetDeviceInfo
,,clCreateProgramWithSource,clCreateProgramWithSource
,,clSetProgramSpecializationConstant,clSetProgramSpecializationConstant
,,clLinkProgram,clLinkProgram
,,clWaitForEvents,clWaitForEvents
,,clEnqueueFillImage,clEnqueueFillImage
,,clCreateSampler,clCreateSampler
,,clReleaseKernel,clReleaseKernel
,,clEnqueueFillBuffer,clEnqueueFillBuffer
,,clCreatePerfCountersCommandQueueINTEL,clCreatePerfCountersCommandQueueINTEL
,,clGetPlatformInfo,clGetPlatformInfo
,,clEnqueueReadBuffer,clEnqueueReadBuffer
,,clGetImageParamsINTEL,clGetImageParamsINTEL
,,clGetKernelSubGroupInfoKHR,clGetKernelSubGroupInfoKHR
,,clUnloadPlatformCompiler,clUnloadPlatformCompiler
,,clCreateImageWithProperties,clCreateImageWithProperties
,,clEnqueueSVMMemFill,clEnqueueSVMMemFill
,,clGetPipeInfo,clGetPipeInfo
,,clGetMemObjectInfo,clGetMemObjectInfo
,,clEnqueueNDRangeKernel,clEnqueueNDRangeKernel
,,clCreateImage,clCreateImage
,,clEnqueueReadImage,clEnqueueReadImage
,,clSVMAlloc,clSVMAlloc
,,clCreateSamplerWithProperties,clCreateSamplerWithProperties
,,clCreateCommandQueue,clCreateCommandQueue
,,clEnqueueMapImage,clEnqueueMapImage
,,clEnqueueSVMMap,clEnqueueSVMMap
,,clGetProgramInfo,clGetProgramInfo
,,clGetAcceleratorInfoINTEL,clGetAcceleratorInfoINTEL
,,clEnqueueMarker,clEnqueueMarker
,,clEnqueueCopyBufferRect,clEnqueueCopyBufferRect
,,clCompileProgram,clCompileProgram
,,clGetKernelArgInfo,clGetKernelArgInfo
,,clRetainMemObject,clRetainMemObject
,,clRetainProgram,clRetainProgram
,,clEnqueueMigrateMemObjects,clEnqueueMigrateMemObjects
,,clRetainDevice,clRetainDevice
,,clGetHostTimer,clGetHostTimer
,,clRetainAcceleratorINTEL,clRetainAcceleratorINTEL
,,clReleaseSampler,clReleaseSampler
,,clEnqueueNativeKernel,clEnqueueNativeKernel
,,clFinish,clFinish
,,clUnloadCompiler,clUnloadCompiler
,,clSetUserEventStatus,clSetUserEventStatus
,,GTPin_Init,GTPin_Init
,,clCreateKernel,clCreateKernel
,,clEnqueueSVMMigrateMem,clEnqueueSVMMigrateMem
,,clEnqueueCopyImage,clEnqueueCopyImage
,,clRetainSampler,clRetainSampler
,,clGetDeviceAndHostTimer,clGetDeviceAndHostTimer
,,clReleaseContext,clReleaseContext
,,clEnqueueWriteBufferRect,clEnqueueWriteBufferRect
,,clCreatePipe,clCreatePipe
,,clReleaseCommandQueue,clReleaseCommandQueue
,,clGetExtensionFunctionAddress,clGetExtensionFunctionAddress
,,clReleaseDevice,clReleaseDevice
,,clEnqueueTask,clEnqueueTask
,,clReleaseEvent,clReleaseEvent
,,clSetDefaultDeviceCommandQueue,clSetDefaultDeviceCommandQueue
,,clCreateUserEvent,clCreateUserEvent
,,clGetKernelWorkGroupInfo,clGetKernelWorkGroupInfo
,,clEnqueueCopyBuffer,clEnqueueCopyBuffer
,,clCreateContext,clCreateContext
,,clGetContextInfo,clGetContextInfo
,,clEnqueueWriteBuffer,clEnqueueWriteBuffer
,,clEnqueueReadBufferRect,clEnqueueReadBufferRect
,,clGetSupportedImageFormats,clGetSupportedImageFormats
,,clEnqueueMapBuffer,clEnqueueMapBuffer
,,clGetKernelSubGroupInfo,clGetKernelSubGroupInfo
,,clSVMFree,clSVMFree
,,clEnqueueMarkerWithWaitList,clEnqueueMarkerWithWaitList
,,clSetKernelArgSVMPointer,clSetKernelArgSVMPointer
,,clCloneKernel,clCloneKernel
,,clEnqueueSVMUnmap,clEnqueueSVMUnmap
,,clRetainCommandQueue,clRetainCommandQueue
,,clGetProgramBuildInfo,clGetProgramBuildInfo
,,clEnqueueBarrier$,clEnqueueBarrier
,,clCreateImage2D,clCreateImage2D
,,clGetKernelInfo,clGetKernelInfo
,,clSetMemObjectDestructorCallback,clSetMemObjectDestructorCallback
,,clCreateKernelsInProgram,clCreateKernelsInProgram
,,clGetEventInfo,clGetEventInfo
,,clGetImageInfo,clGetImageInfo
,,clSetCommandQueueProperty,clSetCommandQueueProperty
,,clCreateProgramWithBuiltInKernels,clCreateProgramWithBuiltInKernels
,,clEnqueueSVMFree,clEnqueueSVMFree
,,clCreateCommandQueueWithProperties,clCreateCommandQueueWithProperties
,,clIcdGetPlatformIDsKHR,clIcdGetPlatformIDsKHR
,,clSetContextDestructorCallback,clSetContextDestructorCallback
,,clEnqueueCopyImageToBuffer,clEnqueueCopyImageToBuffer
,,clEnqueueWriteImage,clEnqueueWriteImage
,,clGetDeviceIDs,clGetDeviceIDs
,,clCreateBuffer,clCreateBuffer
,,clEnqueueUnmapMemObject,clEnqueueUnmapMemObject
,,clCreateProgramWithIL,clCreateProgramWithIL
,,clEnqueueBarrierWithWaitList,clEnqueueBarrierWithWaitList
,,clSetKernelExecInfo,clSetKernelExecInfo
,,clFlush,clFlush
,,clReleaseProgram,clReleaseProgram
,,clEnqueueSVMMemcpy,clEnqueueSVMMemcpy
,,clGetEventProfilingInfo,clGetEventProfilingInfo
,,clSetEventCallback,clSetEventCallback
,,clReleaseAcceleratorINTEL,clReleaseAcceleratorINTEL
,,clReleaseMemObject,clReleaseMemObject
,,clCreateContextFromType,clCreateContextFromType
,,clBuildProgram,clBuildProgram
,,clRetainKernel,clRetainKernel
,,clEnqueueCopyBufferToImage,clEnqueueCopyBufferToImage
,,clSetKernelArg,clSetKernelArg
,,clCreateSubBuffer,clCreateSubBuffer
,,clCreateProgramWithBinary,clCreateProgramWithBinary
,,clGetExtensionFunctionAddressForPlatform,clGetExtensionFunctionAddressForPlatform
,,clCreateBufferWithProperties,clCreateBufferWithProperties
,,clGetCommandQueueInfo,clGetCommandQueueInfo
,,clRetainContext,clRetainContext
,,clSetPerformanceConfigurationINTEL,clSetPerformanceConfigurationINTEL
,,clEnqueueWaitForEvents,clEnqueueWaitForEvents
,,clRetainEvent,clRetainEvent
,,clGetSamplerInfo,clGetSamplerInfo
,,clCreateSubDevices,clCreateSubDevices
130 changes: 130 additions & 0 deletions probes/opencl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#, Header: ".so name","process name","symbol filter","probe name"
#, No space before and after commas
#, Openvino library with debug symbol included
#, set_probes_csv.sh will look into the given process to find library path from loaded .so files
#, If absolute path is given then process name is ignored.
#, Below probes assume openvino plugins are compiled with debug symbols included (e.g -g).

libOpenCL.so,benchmark,clCreateImageWithProperties,clCreateImageWithProperties
,,clBuildProgram,clBuildProgram
,,clGetContextInfo,clGetContextInfo
,,clGetSamplerInfo,clGetSamplerInfo
,,clLinkProgram,clLinkProgram
,,clEnqueueWriteBufferRect,clEnqueueWriteBufferRect
,,clGetGLObjectInfo,clGetGLObjectInfo
,,clCreateProgramWithIL,clCreateProgramWithIL
,,clFinish,clFinish
,,clGetDeviceAndHostTimer,clGetDeviceAndHostTimer
,,clCreateProgramWithSource,clCreateProgramWithSource
,,clRetainKernel,clRetainKernel
,,clEnqueueMigrateMemObjects,clEnqueueMigrateMemObjects
,,clCreateFromGLBuffer,clCreateFromGLBuffer
,,clCreateProgramWithBuiltInKernels,clCreateProgramWithBuiltInKernels
,,clRetainCommandQueue,clRetainCommandQueue
,,clReleaseKernel,clReleaseKernel
,,clFlush,clFlush
,,clCreateBuffer,clCreateBuffer
,,clGetKernelWorkGroupInfo,clGetKernelWorkGroupInfo
,,clReleaseProgram,clReleaseProgram
,,clGetDeviceIDs,clGetDeviceIDs
,,clEnqueueCopyImageToBuffer,clEnqueueCopyImageToBuffer
,,clGetDeviceInfo,clGetDeviceInfo
,,clCreateCommandQueueWithProperties,clCreateCommandQueueWithProperties
,,clEnqueueBarrier$,clEnqueueBarrier
,,clGetMemObjectInfo,clGetMemObjectInfo
,,clEnqueueSVMUnmap,clEnqueueSVMUnmap
,,clEnqueueCopyImage,clEnqueueCopyImage
,,clEnqueueNDRangeKernel,clEnqueueNDRangeKernel
,,clGetPipeInfo,clGetPipeInfo
,,clGetProgramInfo,clGetProgramInfo
,,clCreateCommandQueue,clCreateCommandQueue
,,clGetPlatformIDs,clGetPlatformIDs
,,clSetKernelExecInfo,clSetKernelExecInfo
,,clCreateFromGLTexture2D,clCreateFromGLTexture2D
,,clSetProgramSpecializationConstant,clSetProgramSpecializationConstant
,,clSetMemObjectDestructorCallback,clSetMemObjectDestructorCallback
,,clCreateImage3D,clCreateImage3D
,,clGetPlatformInfo,clGetPlatformInfo
,,clGetGLTextureInfo,clGetGLTextureInfo
,,clGetEventInfo,clGetEventInfo
,,clGetCommandQueueInfo,clGetCommandQueueInfo
,,clRetainSampler,clRetainSampler
,,clCreateSubDevices,clCreateSubDevices
,,clEnqueueSVMFree,clEnqueueSVMFree
,,clEnqueueCopyBuffer,clEnqueueCopyBuffer
,,clGetEventProfilingInfo,clGetEventProfilingInfo
,,clRetainDevice,clRetainDevice
,,clGetHostTimer,clGetHostTimer
,,clEnqueueCopyBufferToImage,clEnqueueCopyBufferToImage
,,clCreateContext,clCreateContext
,,clEnqueueSVMMemcpy,clEnqueueSVMMemcpy
,,clReleaseDevice,clReleaseDevice
,,clSVMFree,clSVMFree
,,clGetProgramBuildInfo,clGetProgramBuildInfo
,,clCloneKernel,clCloneKernel
,,clGetSupportedImageFormats,clGetSupportedImageFormats
,,clGetKernelInfo,clGetKernelInfo
,,clSetDefaultDeviceCommandQueue,clSetDefaultDeviceCommandQueue
,,clSetUserEventStatus,clSetUserEventStatus
,,clCreateKernelsInProgram,clCreateKernelsInProgram
,,clEnqueueFillImage,clEnqueueFillImage
,,clReleaseCommandQueue,clReleaseCommandQueue
,,clSetEventCallback,clSetEventCallback
,,clCreateFromGLRenderbuffer,clCreateFromGLRenderbuffer
,,clGetImageInfo,clGetImageInfo
,,clCreateSubBuffer,clCreateSubBuffer
,,clCreateBufferWithProperties,clCreateBufferWithProperties
,,clEnqueueWriteImage,clEnqueueWriteImage
,,clEnqueueMapImage,clEnqueueMapImage
,,clSetProgramReleaseCallback,clSetProgramReleaseCallback
,,clGetKernelSubGroupInfo,clGetKernelSubGroupInfo
,,clEnqueueReadBuffer,clEnqueueReadBuffer
,,clEnqueueReleaseGLObjects,clEnqueueReleaseGLObjects
,,clUnloadPlatformCompiler,clUnloadPlatformCompiler
,,clCreatePipe,clCreatePipe
,,clSetContextDestructorCallback,clSetContextDestructorCallback
,,clEnqueueSVMMigrateMem,clEnqueueSVMMigrateMem
,,clReleaseContext,clReleaseContext
,,clCreateContextFromType,clCreateContextFromType
,,clEnqueueNativeKernel,clEnqueueNativeKernel
,,clRetainProgram,clRetainProgram
,,clSetCommandQueueProperty,clSetCommandQueueProperty
,,clEnqueueTask,clEnqueueTask
,,clEnqueueMarkerWithWaitList,clEnqueueMarkerWithWaitList
,,clCreateUserEvent,clCreateUserEvent
,,clEnqueueReadImage,clEnqueueReadImage
,,clGetExtensionFunctionAddress,clGetExtensionFunctionAddress
,,clReleaseMemObject,clReleaseMemObject
,,clCreateSampler,clCreateSampler
,,clRetainMemObject,clRetainMemObject
,,clEnqueueSVMMemFill,clEnqueueSVMMemFill
,,clReleaseSampler,clReleaseSampler
,,clEnqueueUnmapMemObject,clEnqueueUnmapMemObject
,,clCreateFromGLTexture3D,clCreateFromGLTexture3D
,,clGetExtensionFunctionAddressForPlatform,clGetExtensionFunctionAddressForPlatform
,,clEnqueueFillBuffer,clEnqueueFillBuffer
,,clReleaseEvent,clReleaseEvent
,,clCreateSamplerWithProperties,clCreateSamplerWithProperties
,,clWaitForEvents,clWaitForEvents
,,clEnqueueMarker,clEnqueueMarker
,,clCreateKernel,clCreateKernel
,,clCreateProgramWithBinary,clCreateProgramWithBinary
,,clEnqueueCopyBufferRect,clEnqueueCopyBufferRect
,,clEnqueueBarrierWithWaitList,clEnqueueBarrierWithWaitList
,,clRetainEvent,clRetainEvent
,,clCreateFromGLTexture,clCreateFromGLTexture
,,clEnqueueReadBufferRect,clEnqueueReadBufferRect
,,clRetainContext,clRetainContext
,,clUnloadCompiler,clUnloadCompiler
,,clEnqueueWaitForEvents,clEnqueueWaitForEvents
,,clCreateImage,clCreateImage
,,clEnqueueMapBuffer,clEnqueueMapBuffer
,,clEnqueueAcquireGLObjects,clEnqueueAcquireGLObjects
,,clSetKernelArg,clSetKernelArg
,,clGetKernelArgInfo,clGetKernelArgInfo
,,clCreateImage2D,clCreateImage2D
,,clSetKernelArgSVMPointer,clSetKernelArgSVMPointer
,,clCompileProgram,clCompileProgram
,,clSVMAlloc,clSVMAlloc
,,clEnqueueWriteBuffer,clEnqueueWriteBuffer
,,clEnqueueSVMMap,clEnqueueSVMMap
10 changes: 0 additions & 10 deletions probes/openvino_probes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#, set_probes_csv.sh will look into the given process to find library path from loaded .so files
#, If absolute path is given then process name is ignored.
#, Below probes assume openvino plugins are compiled with debug symbols included (e.g -g).

# GPU
libopenvino_intel_gpu_plugin.so,benchmark_app,\bov::intel_gpu::SyncInferRequest::infer\(\)\s*$,gpu_infer_request
libopenvino_intel_gpu_plugin.so,,\bov::intel_gpu::Plugin::compile_model\(.*\),gpu_compile_model
Expand All @@ -16,15 +15,6 @@ libopenvino_intel_gpu_plugin.so,,\bcldnn::ocl::typed_primitive_impl_ocl<.*>::exe
libopenvino_intel_gpu_plugin.so,,\bcldnn::onednn::typed_primitive_onednn_impl<.*>::build_primitive,onednn_build_primitive
libopenvino_intel_gpu_plugin.so,,\bcldnn::onednn::typed_primitive_onednn_impl<.*>::execute_impl,onednn_execute_impl
libopenvino_auto_batch_plugin.so,,\bov::autobatch_plugin::Plugin::compile_model\(.*\),auto_batch_compile_model


# CPU
libopenvino_intel_cpu_plugin.so,benchmark_app,\bov::intel_cpu::SyncInferRequest::infer\(\)\s*$, cpu_infer_request
libopenvino_intel_cpu_plugin.so,,\bov::intel_cpu::Plugin::compile_model\(.*\), cpu_compile_model

# Kernel mode driver. i915.ko
i915.ko, ,\bi915_gem_do_execbuffer,i915_gem_do_execbuffer
i915.ko, ,\bii915_gem_wait_ioctl,i915_gem_wait_ioctl
i915.ko, ,\bi915_request_wait_timeout,i915_request_wait_timeout
i915.ko, ,\bflush_submission,flush_submission

3 changes: 0 additions & 3 deletions probes/orbslam_probes.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#, ROS2 libraries
#, set_probes_csv.sh will look into the given process to find library path from loaded .so files
#, If absolute path is given then process name is ignored.

#, ### Disabling below due to too much traffic generating.

libORB_SLAM3.so,slam,TrackRGBD,TrackRGBD
libORB_SLAM3.so,slam,ExtractORB,ExtractORB

Loading

0 comments on commit 56a13d6

Please sign in to comment.