-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: c-profiling test for video vec (#60)
* feat: c-profiling test for video vec * feat: test to find time taken for video vec
- Loading branch information
1 parent
8e74e9e
commit 247f5db
Showing
4 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |