Skip to content

Commit 2050012

Browse files
authored
Merge pull request #12 from hilldani/master
adding SPR support, updating copywrite & license, streamline build
2 parents a069d1c + 6339198 commit 2050012

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2753
-1566
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
name: Build & Test
22

3-
on:
4-
[pull_request,push]
3+
on: [pull_request, push]
54

65
jobs:
76
build:
8-
runs-on: ubuntu-latest
9-
strategy:
10-
fail-fast: false
11-
matrix:
12-
python-version: [3.9]
13-
7+
runs-on: ubuntu-20.04
148
steps:
15-
- uses: actions/checkout@v2
16-
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
18-
with:
19-
python-version: ${{ matrix.python-version }}
20-
- name: Install dependencies
9+
- uses: actions/checkout@v3
10+
- name: install dependencies
2111
run: |
22-
python -m pip install --upgrade pip
23-
pip install flake8 pytest
24-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
25-
- name: Edit memory config
26-
run: sed -i '10 i \ --memory-swap -1 \\' builder/build
27-
- name: Build binaries
28-
run: ./build.sh
29-
- name: Validate with pytest
12+
sudo apt update
13+
sudo apt install -y python3
14+
sudo snap install go --classic
15+
pip3 install -r requirements.txt
16+
- name: build
3017
run: |
31-
builder/test
18+
make dist
19+
- name: upload artifact
20+
uses: actions/upload-artifact@v3
21+
with:
22+
name: perfspect
23+
path: dist/perfspect*.tgz

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/*
2+
dist/*
3+
pmu-checker/pmu-checker
4+
src/libtsc.so

CODE_OF_CONDUCT.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
CommunityCodeOfConduct AT intel DOT com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series of
86+
actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or permanent
93+
ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.1, available at
119+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120+
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123+
124+
For answers to common questions about this code of conduct, see the FAQ at
125+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126+
[https://www.contributor-covenant.org/translations][translations].
127+
128+
[homepage]: https://www.contributor-covenant.org
129+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130+
[Mozilla CoC]: https://github.com/mozilla/diversity
131+
[FAQ]: https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Contributing
2+
3+
### License
4+
5+
PerfSpect is licensed under the terms in [LICENSE](./LICENSE). By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
6+
7+
### Sign your work
8+
9+
Please use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify
10+
the below (from [developercertificate.org](http://developercertificate.org/)):
11+
12+
```
13+
Developer Certificate of Origin
14+
Version 1.1
15+
16+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
17+
660 York Street, Suite 102,
18+
San Francisco, CA 94110 USA
19+
20+
Everyone is permitted to copy and distribute verbatim copies of this
21+
license document, but changing it is not allowed.
22+
23+
Developer's Certificate of Origin 1.1
24+
25+
By making a contribution to this project, I certify that:
26+
27+
(a) The contribution was created in whole or in part by me and I
28+
have the right to submit it under the open source license
29+
indicated in the file; or
30+
31+
(b) The contribution is based upon previous work that, to the best
32+
of my knowledge, is covered under an appropriate open source
33+
license and I have the right under that license to submit that
34+
work with modifications, whether created in whole or in part
35+
by me, under the same open source license (unless I am
36+
permitted to submit under a different license), as indicated
37+
in the file; or
38+
39+
(c) The contribution was provided directly to me by some other
40+
person who certified (a), (b) or (c) and I have not modified
41+
it.
42+
43+
(d) I understand and agree that this project and the contribution
44+
are public and that a record of the contribution (including all
45+
personal information I submit with it, including my sign-off) is
46+
maintained indefinitely and may be redistributed consistent with
47+
this project or the open source license(s) involved.
48+
```
49+
50+
Then you just add a line to every git commit message:
51+
52+
Signed-off-by: Joe Smith <[email protected]>
53+
54+
Use your real name (sorry, no pseudonyms or anonymous contributions.)
55+
56+
If you set your `user.name` and `user.email` git configs, you can sign your
57+
commit automatically with `git commit -s`.

Makefile

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,104 @@
1+
COMMIT_ID := $(shell git rev-parse --short=8 HEAD)
2+
COMMIT_DATE := $(shell git show -s --format=%cd --date=short HEAD)
13
VERSION_FILE := _version.txt
4+
VERSION_BASE := $(COMMIT_DATE)_$(COMMIT_ID)
25
VERSION_NUMBER := $(shell cat ${VERSION_FILE})
36
VERSION_PUBLIC := $(VERSION_NUMBER)
4-
PACKAGE := perfspect_$(VERSION_NUMBER).tgz
7+
PACKAGE_EXTERNAL := perfspect_$(VERSION_NUMBER).tgz
58
BINARY_FINAL := perfspect
69
BINARY_COLLECT := perf-collect
710
BINARY_POSTPROCESS := perf-postprocess
8-
911
default: all
1012

11-
.PHONY: all test default dist clean format format_check security_scan flakes mypy pytype source_check checkmake dist/$(PACKAGE)
13+
.PHONY: all test default dist clean format format_check security_scan flakes source_check checkmake dist/version_file dist/$(SOURCE_PACKAGE)
1214

1315
clean_dir:
1416
rm -rf build/*
1517
rm -rf dist/*
16-
sudo rm -rf test/perf*
18+
#sudo rm -rf test/$(BINARY_FINAL)
1719
rm -rf src/__pycache__
1820

1921
build_dir: clean_dir
2022
mkdir -p build
21-
mkdir -p dist
2223

2324
build/pmu-checker:
2425
cd pmu-checker && make
2526
cp pmu-checker/pmu-checker build/
2627
strip -s -p --strip-unneeded build/pmu-checker
2728

2829
build/libtsc:
29-
cd src && gcc -shared -o libtsc.so -fPIC calibrate.c
30+
gcc -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv -fPIC -shared -o src/libtsc.so src/calibrate.c
3031

31-
build/collect:
32+
build-public/collect:
3233
$(eval TMPDIR := $(shell mktemp -d build.XXXXXX))
3334
mkdir -p $(TMPDIR)/src
3435
mkdir -p $(TMPDIR)/events
3536
cp src/* $(TMPDIR)/src && cp events/* $(TMPDIR)/events && cp *.py $(TMPDIR)
36-
sed -i 's/PerfSpect_DEV_VERSION/$(VERSION_PUBLIC)/g' $(TMPDIR)/src/perf_helpers.py
37+
sed -i 's/PerfSpect_DEV_VERSION/$(VERSION_PUBLIC)/g' $(TMPDIR)/src/perf_helpers.py
3738
cd $(TMPDIR) && pyinstaller -F perf-collect.py -n $(BINARY_COLLECT) \
3839
--add-data "./src/libtsc.so:." \
3940
--add-data "./events/bdx.txt:." \
4041
--add-data "./events/skx.txt:." \
41-
--add-data "./events/skx_aws.txt:." \
42-
--add-data "./events/skx_oci.txt:." \
4342
--add-data "./events/clx.txt:." \
44-
--add-data "./events/clx_aws.txt:." \
4543
--add-data "./events/icx.txt:." \
44+
--add-data "./events/spr.txt:." \
4645
--add-data "./events/icx_aws.txt:." \
47-
--add-data "./events/icx_oci.txt:." \
46+
--add-data "./events/spr_aws.txt:." \
47+
--add-data "./events/clx_aws.txt:." \
48+
--add-data "./events/skx_aws.txt:." \
4849
--add-binary "../build/pmu-checker:." \
49-
--runtime-tmpdir .
50+
--runtime-tmpdir . \
51+
--exclude-module readline
52+
5053
cp $(TMPDIR)/dist/$(BINARY_COLLECT) build/
5154
rm -rf $(TMPDIR)
5255

53-
build/postprocess:
56+
build-public/postprocess:
5457
$(eval TMPDIR := $(shell mktemp -d build.XXXXXX))
55-
git clone https://github.com/danthedeckie/simpleeval.git
56-
cp simpleeval/simpleeval.py .
5758
mkdir -p $(TMPDIR)/src
5859
mkdir -p $(TMPDIR)/events
5960
cp src/* $(TMPDIR)/src && cp events/* $(TMPDIR)/events && cp *.py $(TMPDIR)
60-
sed -i 's/PerfSpect_DEV_VERSION/$(VERSION_PUBLIC)/g' $(TMPDIR)/src/perf_helpers.py
61+
sed -i 's/PerfSpect_DEV_VERSION/$(VERSION_PUBLIC)/g' $(TMPDIR)/src/perf_helpers.py
6162
cd $(TMPDIR) && pyinstaller -F perf-postprocess.py -n perf-postprocess \
6263
--add-data "./events/metric_skx_clx.json:." \
6364
--add-data "./events/metric_bdx.json:." \
6465
--add-data "./events/metric_icx.json:." \
65-
--add-data="simpleeval.py:." \
66-
--runtime-tmpdir .
66+
--add-data "./events/metric_spr.json:." \
67+
--add-data "./events/metric_icx_aws.json:." \
68+
--add-data "./events/metric_spr_aws.json:." \
69+
--runtime-tmpdir . \
70+
--exclude-module readline
6771
cp $(TMPDIR)/dist/perf-postprocess build/
68-
rm -rf simpleeval && rm -f simpleeval.py
6972
rm -rf $(TMPDIR)
7073

71-
dist/$(PACKAGE): build_dir build/pmu-checker build/libtsc build/collect build/postprocess
72-
rm -rf dist/*
73-
cp build/$(BINARY_COLLECT) dist/$(BINARY_COLLECT)
74-
cp build/$(BINARY_POSTPROCESS) dist/$(BINARY_POSTPROCESS)
75-
rm -rf build
76-
74+
dist/$(PACKAGE_EXTERNAL): build_dir build/pmu-checker build/libtsc build-public/collect build-public/postprocess
75+
rm -rf dist/$(BINARY_FINAL)/
76+
mkdir -p dist/$(BINARY_FINAL)
77+
cp build/$(BINARY_COLLECT) dist/$(BINARY_FINAL)/$(BINARY_COLLECT)
78+
cp build/$(BINARY_POSTPROCESS) dist/$(BINARY_FINAL)/$(BINARY_POSTPROCESS)
79+
cp LICENSE dist/$(BINARY_FINAL)/
80+
cp README.md dist/$(BINARY_FINAL)/README.md
81+
cd dist && tar -czf $(PACKAGE_EXTERNAL) $(BINARY_FINAL)
82+
cd dist && cp -r $(BINARY_FINAL) ../build/
83+
rm -rf dist/$(BINARY_FINAL)/
84+
cd dist && md5sum $(PACKAGE_EXTERNAL) > $(PACKAGE_EXTERNAL).md5
7785

7886
test:
79-
cp dist/$(BINARY_COLLECT) dist/$(BINARY_POSTPROCESS) test/
87+
cd dist && tar -xvf perfspect_$(VERSION_PUBLIC).tgz && cp -r $(BINARY_FINAL) ../test/.
8088
cd test && pytest
8189

82-
security_scan: src/*.py
83-
bandit src
84-
bandit *.py
85-
8690
format:
8791
black src
8892
black *.py
8993

9094
format_check:
9195
black --check src
92-
black --check *.py
96+
black --check perf-collect.py perf-postprocess.py
9397

9498
error_check: # ignore false positives
95-
flake8 --ignore=E501,W503,F403,F405 src
96-
flake8 --ignore=E203,E501,E722,W503,F403,F405 *.py
99+
flake8 --ignore=E501,W503,F403,F405,E741 src
100+
flake8 --ignore=E203,E501,E722,W503,F403,F405 *.py --exclude simpleeval.py,perfmon.py,average.py
97101

98102
source_check: security_scan format_check error_check
99103

100-
dist: source_check dist/$(PACKAGE)
101-
104+
dist: source_check dist/$(PACKAGE_EXTERNAL)

0 commit comments

Comments
 (0)