aboutsummaryrefslogtreecommitdiffstats
path: root/resources/ansible_roles/unixbench/tasks/main.yml
blob: 64e1021d3c06c7b45a25cea9970912afa98d8cc7 (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
#############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#############################################################################

- name: make unixbench working directory
  file:
    path: "{{ workdir }}"
    state: directory

- name: downloading unixbench source code
  get_url:
    url: https://github.com/kdlucas/byte-unixbench/archive/v5.1.3.tar.gz
    dest: "{{ workdir }}"
    checksum: "sha256:3a6bb00f270a5329682dff20fd2c1ab5332ef046eb54a96a0d7bd371005d31a3"

- name: extracting unixbench source code
  # TODO(yujunz) unarchive may not work with long path (local: macOS, workdir: /root/qtip-workdir-20170423-0836/)
  command: "tar zxf byte-unixbench-5.1.3.tar.gz"
  args:
    chdir: "{{ workdir }}"
    creates: byte-unixbench-5.1.3

- name: build UnixBench
  command: "make"
  args:
    chdir: "{{ workdir }}/byte-unixbench-5.1.3/UnixBench"
    creates: Run

- name: run whetstone and dhrystone
  shell: "./Run -i {{ iterations }} -c {{ parallel_copies }} dhrystone whetstone"
  args:
    chdir: "{{ workdir }}/byte-unixbench-5.1.3/UnixBench"
  register: unixbench_out

- name: saving unixbench output to log
  copy:
    content: "{{ unixbench_out.stdout }}"
    dest: "{{ logfile }}"
  delegate_to: localhost

- name: collecting arithmetic metrics from unixbench
  collect:
    string: "{{ lookup('file', logfile) }}"
    patterns:
      # Dhrystone 2 using register variables         116700.0   29223521.3   2504.2
      # Double-Precision Whetstone                       55.0       3720.5    676.5
      - '^Dhrystone 2 using register variables\s+(\d+\.\d+)\s+(?P<dhrystone_lps>\d+\.\d+)\s+(\d+\.\d+)'
      - '^Double-Precision Whetstone\s+(\d+\.\d+)\s+(?P<whetstone_MWIPS>\d+\.\d+)\s+(\d+\.\d+)'
    dest: "{{ output }}/metrics.json"
  register: arithmetic_metrics
  delegate_to: localhost

- name: creating arithmetic metrics report
  template:
    src: arithmetic-metrics.j2
    dest: "{{ output }}/report"
  delegate_to: localhost