There is a profiling interface called IProfiler in TensorRT libraries.
You can find a sample code to use it in /usr/src/tensorrt/samples/sampleGoogleNet/sampleGoogleNet.cpp.
More details can also be found in our document here:
application-implemented interface for profiling
When this class is added to an execution context, the profiler will be called once per layer for each invocation of execute(). Note that enqueue() does not currently support profiling.
the profiler will only be called after execution is complete. It has a small impact on execution time.