我想知道这段代码消耗了多少内存。还可用内存在我的pc使用python代码。必须做些什么?
下面是我的代码:from moviepy.editor import *
import os
import glob
from natsort import natsorted
import datetime
import time
import shutil
from concurrent.futures import ThreadPoolExecutor
def fast(path, thread_name):
if os.path.splitext(path)[1] == '.mp4':
print("Start : " + str(thread_name) + " - " + str(datetime.datetime.now()))
clip = (VideoFileClip(path).fx(vfx.speedx, 5))
clip.to_videofile('G:/Ocsid Technologies/BUILDERS/Builder-1/Project-1/Converted Videos/' +
thread_name + '.mp4', codec='libx264')
time.sleep(3)
shutil.move(path, "G:/Ocsid Technologies/BUILDERS/Builder-1/Project-1/Original Videos/")
print("End : " + str(thread_name) + " - " + str(datetime.datetime.now()))
with ThreadPoolExecutor(5) as pool:
for i, filename in enumerate(glob.glob("G:/Ocsid Technologies/BUILDERS/Builder-1/Project-1/Raw
Videos/*.mp4"), 1):
pool.submit(fast, filename, f"t{i}")
如果您使用Visual Studio Code,您可以添加两个中断点(代码的开始和结束),并且使用Diagnostic Tools窗口您可以获得这些数据。
Visual Studio Code中的诊断工具
Visual Studio Code中的诊断工具
下面的链接(西班牙语),其中解释
https://learn.microsoft.com/es es/visualstudio/profiling/memory - usage?view=vs - 2022
我希望它有帮助