Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / testing / selftests / damon / sysfs_update_schemes_tried_regions_hang.py
blob28c887a0108fde91c252c8b1a92fb27e3a0db337
1 #!/usr/bin/env python3
2 # SPDX-License-Identifier: GPL-2.0
4 import subprocess
5 import time
7 import _damon_sysfs
9 def main():
10 proc = subprocess.Popen(['sleep', '2'])
11 kdamonds = _damon_sysfs.Kdamonds([_damon_sysfs.Kdamond(
12 contexts=[_damon_sysfs.DamonCtx(
13 ops='vaddr',
14 targets=[_damon_sysfs.DamonTarget(pid=proc.pid)],
15 schemes=[_damon_sysfs.Damos(
16 access_pattern=_damon_sysfs.DamosAccessPattern(
17 nr_accesses=[200, 200]))] # schemes
18 )] # contexts
19 )]) # kdamonds
21 err = kdamonds.start()
22 if err != None:
23 print('kdamond start failed: %s' % err)
24 exit(1)
26 while proc.poll() == None:
27 err = kdamonds.kdamonds[0].update_schemes_tried_bytes()
28 if err != None:
29 print('tried bytes update failed: %s' % err)
30 exit(1)
32 if __name__ == '__main__':
33 main()