-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstat.py
More file actions
27 lines (23 loc) · 850 Bytes
/
Copy pathstat.py
File metadata and controls
27 lines (23 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time
import os
import sys
import pandas as pd
# 要执行的命令列表
# commands = ["./build/bin/number-calc", "./build/bin/number-calc-js", "./build/bin/number-calc-c-d", "./build/bin/number-calc-c-O0", "./build/bin/number-calc-c-O1"]
commands = sys.argv[1].split(',')
# 存储执行时间的数据结构
times = []
# 执行每个命令并记录时间
for command in commands:
start_time = time.time()
# 执行命令(这里可以使用 subprocess 模块来实际执行命令)
# 这里只是模拟执行
print(f"执行命令: {command}")
# time.sleep(1)
os.system(command)
end_time = time.time()
execution_time = end_time - start_time
times.append((command, execution_time))
# 创建数据框并展示统计表格
df = pd.DataFrame(times, columns=['命令', '执行时间(秒)'])
print(df)