forked from intel/intel-cmt-cat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CONTRIBUTING
executable file
·262 lines (174 loc) · 6.99 KB
/
CONTRIBUTING
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
Contributing to intel-cmt-cat
=============================
As an open source project, we welcome contributions of any kind.
These can range from bug reports, code reviews and code development,
to significant code or documentation features.
How can I contribute?
=====================
This document specifies contributing guidelines to the intel-cmt-cat source
tree. It covers some general guidelines, the preferred style and formatting
for source files, additional requirements like documentation
and development workflow. The goal of this document is to walk you through
the concepts and specifics that should be understood while contributing
to intel-cmt-cat.
Reporting Bugs
==============
Bugs should be reported via GitHub issues. The description should include
a platform name, OS and kernel version, PQoS library version and detailed
information how to reproduce the bug.
Suggesting Enhancements
=======================
Improvements should be reported via GitHub issues or pull requests.
Creating Pull Requests
======================
Pull requests should be created using standard procedure available on GitHub.
It is important to fill in all required information into a template. For major
modifications (e.g. adding a new feature, refactoring), for effective
development, it is recommended to share high level document with core
development team via GitHub issue so that one can ask questions if one foresees
issues that may occur in existing development.
Coding Style Guides
===================
General Guidelines
==================
The rules and guidelines given in this document cannot cover every situation,
so the following general guidelines should be used as a fallback:
The code style should be consistent within each individual file.
In the case of creating new files, the style should be consistent within
each file in a given directory or module. The primary reason for coding
standards is to increase code readability and comprehensibility, therefore
always use whatever option will make the code easier to read. Line length
is recommended to be not more than 80 characters, including comments.
C
=
Formatting using checkpatch.pl
==============================
To format your code please use checkpatch.pl script (version 0.32) from
Linux kernel
(https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl).
Indentation
===========
Tabs are 8 characters and thus indentations are also 8 characters.
It should be consistent within each part of the code. When adding a new file,
spaces should be used over tabs.
C Comment Style
===============
Usual Comments
==============
These comments should be used in normal cases. To document a public API,
a doxygen-like format must be used: refer to Doxygen Guidelines
(http://www.doxygen.nl/manual/docblocks.html).
/*
* VERY important single-line comments look like this.
*/
/* Most single-line comments look like this. */
/*
* Multi-line comments look like this. Make them real sentences. Fill
* them so they look like real paragraphs.
*/
License Header
==============
Each file should begin with a special comment containing the appropriate
copyright and license for the file. Generally this is the BSD License,
except for code for Linux Kernel modules. After any copyright header,
a blank line should be left before any other contents, e.g. include statements
in a C file.
Preprocessor Directives (Header Includes)
=========================================
Include files from the local application directory are included using quotes,
while includes from other paths are included using angle brackets: “<>”.
Example:
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "pqos.h"
#include "cap.h"
#include "allocation.h"
#include "os_allocation.h"
#include "machine.h"
#include "types.h"
#include "log.h"
Header File Guards
==================
Headers should be protected against multiple inclusion with the usual:
#ifndef _FILE_H_
#define _FILE_H_
/* Code */
#endif /* _FILE_H_ */
Macros
======
You can define a macro similar in C using #define preprocessor directive.
For example:
/**
* ---------------------------------------
* Local macros
* ---------------------------------------
*/
/**
* Allocation & Monitoring association MSR register
* - bits [63..32] QE COS
* - bits [31..10] Reserved
* - bits [9..0] RMID
*/
#define PQOS_MSR_ASSOC 0xC8F
#define PQOS_MSR_ASSOC_QECOS_SHIFT 32
#define PQOS_MSR_ASSOC_QECOS_MASK 0xffffffff00000000ULL
Public APIs in libpqos
======================
All functions that are exposed by the library must have their prototypes
defined in lib/pqos.h.
Python
======
Python code in this repository except examples has associated .pylintrc
configuration file for Pylint tool. The code should be rated at 10.0/10.0
by this linter. Optionally it is allowed to disable some checks in code using
comments.
Perl
====
Perl code should be checked (and reformatted if necessary) using Perltidy tool.
These are the recommended flags:
-bar - keep the brace on the right even for multiple-line test expressions
-ce - cuddled else
-pt=2 - parentheses horizontal tightness - space is never used
-sbt=2 - square brackets horizontal tightness - space is never used
-bbt=2 - code block curly braces horizontal tightness - space is never used
-et=4 - entab leading whitespace with one tab character for each 4 spaces
-baao - "break after all operators"
-nsfs - no space before a semicolon in a for statement
-vtc=1 - do not break before a closing token which is followed by a semicolon
or another closing token, and is not in a list environment
-ci=4 - continuation indentation - extra indentation spaces applied when
a long line is broken, 4 spaces
Documentation
=============
Please make sure to update documentation when necessary. If not possible
(e.g. not allowed to edit wiki), propose necessary changes.
Git Commit Messages
===================
Git commit messages should start with a short 50 character or less summary
in a single paragraph. Ideally, it should start with a short prefix
followed by a colon describing which part of the code it modifies
e.g. "pqos: show supported features".
Development Workflow
====================
Clone a repository in the usual way, for example:
git clone https://github.com/intel/intel-cmt-cat
Once your local repository is set up as above, you must use
the following workflow.
Make sure you have the latest upstream changes:
git remote update
git checkout master
git pull origin master
Committing a Change
===================
Make your changes, commit them, and submit them for review:
git commit -a
To see how to create pull requests on GitHub, please refer to "About pull
requests" help page (https://help.github.com/articles/about-pull-requests/).
Note: Please ensure that you have your username and email address set correctly
to let other developers know about your contribution:
git config --global user.name "Firstname Lastname"
git config --global user.email "[email protected]"
Licenses
========
The code in this repository is licensed under BSD license (see LICENSE file).