-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding "perf_lock" Tests. #2811
Adding "perf_lock" Tests. #2811
Conversation
Run logs: root@new:~/avocado-fvt-wrapper/tests/avocado-misc-tests/perf # avocado run perf_lock.py -m perf_lock.py.data/test_report.yaml --max-parallel-tasks=1 root@new:~/avocado-fvt-wrapper/tests/avocado-misc-tests/perf # avocado run perf_lock.py --max-parallel-tasks=1 Log files: |
perf/perf_lock.py
Outdated
# Report command | ||
if self.record == 'report': | ||
report_cmd = "perf lock %s %s " % (self.record, self.option) | ||
if self.option in ["--kallsyms"]: | ||
self.option = self.get_kernel_version() | ||
report_cmd = "perf lock %s %s -E 3" % (self.record, | ||
self.option) | ||
if self.check_perfdata_file_exist: | ||
self.run_cmd(report_cmd) | ||
|
||
# Info command | ||
elif self.record == 'info': | ||
report_cmd = "perf lock %s %s" % (self.record, self.option) | ||
if self.check_perfdata_file_exist: | ||
self.run_cmd(report_cmd) | ||
|
||
# Script command | ||
elif self.record == 'script': | ||
report_cmd = "perf lock %s %s %s" % (self.record, | ||
self.option, | ||
self.output_file) | ||
if self.check_perfdata_file_exist: | ||
self.run_cmd(report_cmd) | ||
|
||
# contention command | ||
elif self.record == 'contention': | ||
report_cmd = "perf lock %s %s" % (self.record, self.option) | ||
if self.option in ["--vmlinux"]: | ||
self.option = self.get_kernel_version() | ||
report_cmd = "perf lock %s %s" % (self.record, self.option) | ||
elif self.option in ["-i"]: | ||
report_cmd = "perf lock %s %s %s" % (self.record, | ||
self.option, | ||
self.output_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this can be clubbed in a single command. Inside this you can have checks for --kallsyms and --vmlinux. Other than that other parameters should be part of yaml file.
report_cmd = "perf lock -i %s %s %s" % (self.output_file, self.record, self.option)
record: | ||
name: record | ||
variants: !mux | ||
all_cpus: | ||
option: -a -v sleep 3 | ||
scheduling_message: | ||
option: -- perf bench sched messaging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are you running these record commands in the py file?
name: script | ||
variants: !mux | ||
input_data: | ||
option: -i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add -f also in option option: -f -i
locks_with_entries: | ||
option: -c -D -E 5 | ||
vmlinux_full: | ||
option: --kallsyms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-E 3 you can add here instead of .py file
option: -E 3 --kallsyms
trace_PID: | ||
option: -p 1 -x , | ||
input_full: | ||
option: -i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try with option: -Y spinlock -q -i
input_full: | ||
option: -i | ||
vmlinux_full: | ||
option: --vmlinux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can change it to option: -E 2 --vmlinux
perf/perf_lock.py
Outdated
def get_kernel_version(self): | ||
''' | ||
Funtion to get kernel version based on distro type | ||
''' | ||
|
||
if 'rhel' in self.distro_name: | ||
self.kernel_version = self.option + \ | ||
" /boot/vmlinuz-" + platform.uname()[2] | ||
elif 'SuSE' in self.distro_name: | ||
self.kernel_version = self.option + \ | ||
" /boot/vmlinux-" + platform.uname()[2] | ||
return self.kernel_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need of this function separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perf command is provided by 'perf' package.Can we have this included along with make, gcc and not as a extended package ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FarooqAbdulla02 can you add a README.txt as this a new test script.
@Naresh-ibm added "readme.txt" file with supported option set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FarooqAbdulla02 thanks for patch , a couple of suggestion can you please address review comment and seems py file has a lot of whitespace please trim those
perf/perf_lock.py
Outdated
""" | ||
Tests perf lock and it's options namely record, report, info, script | ||
contention with all possible flags with the help of yaml file | ||
:avocado: tags=perf,lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel lock should not tag as tag is used to filter and align in category
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PraveenPenguin sure, will remove "lock" here.
perf/perf_lock.py
Outdated
|
||
# Check perf lock is available in the system. | ||
output = process.run('perf list | awk \'/lock:contention*/\'', | ||
shell=True).stdout.decode("utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard to achieve this using python ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PraveenPenguin we can achieve same output with this command
command = 'perf list | grep lock:contention*'
output = process.run(command, shell=True).stdout.decode("utf-8")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FarooqAbdulla02 don't grep for lock:contention as its a subcommand in perf lock. we want to see if lock is enabled or not before running the test. You can use below command to check.
perf list|grep -iw lock:.*
@FarooqAbdulla02 can you please check on Praveen's comments and re-push if needed? |
Adding test of "perf lock" command with options called "record", "report", "info", "script", "contention" with all possible through YAML file. Signed-off-by: Shaik Abdulla <[email protected]>
9e41506
to
16fb622
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It seems this testcase doen't cover installing clang and other required bpf packages. So it might miss some of the functionality testing. Can you also add bpf part |
Adding test of "perf lock" command with options called "record",
"report", "info", "script", "contention" with all possible through YAML file.