Skip to content

Commit

Permalink
feat: c-profiling test for video vec (#60)
Browse files Browse the repository at this point in the history
* feat: c-profiling test for video vec

* feat: test to find time taken for video vec
  • Loading branch information
aatmanvaidya authored Feb 7, 2024
1 parent 8e74e9e commit 247f5db
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/api/video_vec_operator_cprofile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import cProfile
import pstats
from io import StringIO
from core.operators import vid_vec_rep_resnet

def profile_code():
file_path = {"path": r"core/operators/sample_data/sample-cat-video.mp4"}
vid_vec_rep_resnet.initialize(param=None)
profiler = cProfile.Profile()
profiler.enable()
vid_vec_rep_resnet.run(file_path)
profiler.disable()
result_stream = StringIO()
stats = pstats.Stats(profiler, stream=result_stream).sort_stats('cumulative')
stats.print_stats()
print(result_stream.getvalue())

if __name__ == "__main__":
profile_code()
2 changes: 2 additions & 0 deletions src/api/video_vec_operator_cprofile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python video_vec_operator_cprofile.py > output_cprofile.txt
tail -f /dev/null
14 changes: 14 additions & 0 deletions src/api/video_vec_operator_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import time
from core.operators import vid_vec_rep_resnet

def find_time():
file_path = {"path": r"core/operators/sample_data/sample-cat-video.mp4"}
vid_vec_rep_resnet.initialize(param=None)
start_time = time.time()
vid_vec_rep_resnet.run(file_path)
end_time = time.time()
duration = end_time - start_time
print(f"Time taken - {duration}")

if __name__ == "__main__":
find_time()
2 changes: 2 additions & 0 deletions src/api/video_vec_operator_time.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python video_vec_operator_time.py > output_time.txt
tail -f /dev/null

0 comments on commit 247f5db

Please sign in to comment.