chore: move examples to dedicated directory

This commit is contained in:
Matteo Bernardini
2025-08-06 12:59:57 +08:00
committed by Lars Immisch
parent 0b3f1f41c7
commit df5c2f4685
7 changed files with 0 additions and 0 deletions

25
examples/play_rusage.py Normal file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python
# Contributed by Stein Magnus Jodal
from __future__ import print_function
import resource
import time
import alsaaudio
seconds = 0
max_rss = 0
device = alsaaudio.PCM()
while True:
device.write(b'\x00' * 44100)
time.sleep(1)
seconds += 1
if seconds % 10 == 0:
prev_rss = max_rss
max_rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
diff_rss = max_rss - prev_rss
print('After %ds: max RSS %d kB, increased %d kB' % (
seconds, max_rss, diff_rss))