summaryrefslogtreecommitdiffstats
path: root/qemu/tests/tcg/lm32/helper.S
blob: 3351d41e84255c23d0f84c28064b89988a109d42 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.text
.global _start, _write, _exit
.global _tc_fail, _tc_pass

_write:
	addi sp, sp, -4
	sw (sp+4), r8
	mvi r8, 5
	scall
	lw r8, (sp+4)
	addi sp, sp, 4
	ret

_exit:
	mvi r8, 1
	scall
1:
	bi 1b

_tc_pass:
.data
1:
	.ascii "OK\n"
2:
.text
	addi sp, sp, -16
	sw (sp+4), ra
	sw (sp+8), r1
	sw (sp+12), r2
	sw (sp+16), r3
	mvi r1, 1
	mvhi r2, hi(1b)
	ori r2, r2, lo(1b)
	mvi r3, (2b - 1b)
	calli _write
	lw r3, (sp+16)
	lw r2, (sp+12)
	lw r1, (sp+8)
	lw ra, (sp+4)
	addi sp, sp, 16
	ret

_tc_fail:
.data
1:
	.ascii "FAILED\n"
2:
.text
	addi sp, sp, -16
	sw (sp+4), ra
	sw (sp+8), r1
	sw (sp+12), r2
	sw (sp+16), r3
	sw (sp+4), ra
	mvi r1, 1
	mvhi r2, hi(1b)
	ori r2, r2, lo(1b)
	mvi r3, (2b - 1b)
	calli _write
	lw r3, (sp+16)
	lw r2, (sp+12)
	lw r1, (sp+8)
	lw ra, (sp+4)
	addi sp, sp, 16
	ret
s="p">, stress_config['tool']) return # calculate requested load details and load split among different # types of workers cpus = systeminfo.get_cpu_cores() if 'reserved' in stress_config: cpus = cpus - int(stress_config['reserved']) if cpus < 1: cpus = 1 workers = round(cpus/100 * int(stress_config['load'])) cmd_dict = {} p_types = {} p_total = 0 for p_type in ('c', 'i', 'm'): p_count = stress_config['pattern'].lower().count(p_type) if p_count > 0: p_types[p_type] = p_count p_total += p_count if p_total < 1: self._logger.error('stress test pattern does not contain any of ' \ 'c, i or m pattern types') return for p_type in p_types: cmd_dict['-'+p_type] = round(workers* p_types[p_type] / p_total) # check for memory load in case that memory workers are detected # in case of error or 0%, memory size is not specified and default # amount of memory will be used by stress tool if '-m' in cmd_dict and cmd_dict['-m'] > 0: if 'load_memory' in stress_config and \ stress_config['load_memory'] > 0 and \ stress_config['load_memory'] <= 100: mem = systeminfo.get_memory_bytes() if mem: cmd_dict['--vm-bytes'] = round(int(mem) / 100 * \ stress_config['load_memory'] / cmd_dict['-m']) # append stress arguments to cmd list used by parent class Process for key, value in cmd_dict.items(): process_args['cmd'].append(key) process_args['cmd'].append(str(value)) # append load generator options if specified if 'options' in stress_config: process_args['cmd'].append(stress_config['options']) # initialize load generator and remember it super(Stress, self).__init__(**process_args) self._running = True def start(self): """Start stress load if it was requested """ if self._running: super(Stress, self).start() def kill(self, signal='-15', sleep=2): """ Kill stress load if it is active """ if self._running and self._child and self._child.isalive(): tasks.run_task(['sudo', 'pkill', signal, self._proc_name], self._logger) time.sleep(sleep) self._logger.info( 'Log available at %s', self._logfile) self._running = False