Blame CONTRIBUTING

Packit Service 8a4b7a
Contributing to intel-cmt-cat
Packit Service 8a4b7a
=============================
Packit Service 8a4b7a
Packit Service 8a4b7a
As an open source project, we welcome contributions of any kind.
Packit Service 8a4b7a
These can range from bug reports, code reviews and code development,
Packit Service 8a4b7a
to significant code or documentation features.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
How can I contribute?
Packit Service 8a4b7a
=====================
Packit Service 8a4b7a
Packit Service 8a4b7a
This document specifies contributing guidelines to the intel-cmt-cat source
Packit Service 8a4b7a
tree. It covers some general guidelines, the preferred style and formatting
Packit Service 8a4b7a
for source files, additional requirements like documentation
Packit Service 8a4b7a
and development workflow. The goal of this document is to walk you through
Packit Service 8a4b7a
the concepts and specifics that should be understood while contributing
Packit Service 8a4b7a
to intel-cmt-cat.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Reporting Bugs
Packit Service 8a4b7a
==============
Packit Service 8a4b7a
Packit Service 8a4b7a
Bugs should be reported via GitHub issues. The description should include
Packit Service 8a4b7a
a platform name, OS and kernel version, PQoS library version and detailed
Packit Service 8a4b7a
information how to reproduce the bug.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Suggesting Enhancements
Packit Service 8a4b7a
=======================
Packit Service 8a4b7a
Packit Service 8a4b7a
Improvements should be reported via GitHub issues or pull requests.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Creating Pull Requests
Packit Service 8a4b7a
======================
Packit Service 8a4b7a
Packit Service 8a4b7a
Pull requests should be created using standard procedure available on GitHub.
Packit Service 8a4b7a
It is important to fill in all required information into a template. For major
Packit Service 8a4b7a
modifications (e.g. adding a new feature, refactoring), for effective
Packit Service 8a4b7a
development, it is recommended to share high level document with core
Packit Service 8a4b7a
development team via GitHub issue so that one can ask questions if one foresees
Packit Service 8a4b7a
issues that may occur in existing development.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Coding Style Guides
Packit Service 8a4b7a
===================
Packit Service 8a4b7a
Packit Service 8a4b7a
General Guidelines
Packit Service 8a4b7a
==================
Packit Service 8a4b7a
Packit Service 8a4b7a
The rules and guidelines given in this document cannot cover every situation,
Packit Service 8a4b7a
so the following general guidelines should be used as a fallback:
Packit Service 8a4b7a
Packit Service 8a4b7a
The code style should be consistent within each individual file.
Packit Service 8a4b7a
In the case of creating new files, the style should be consistent within
Packit Service 8a4b7a
each file in a given directory or module. The primary reason for coding
Packit Service 8a4b7a
standards is to increase code readability and comprehensibility, therefore
Packit Service 8a4b7a
always use whatever option will make the code easier to read. Line length
Packit Service 8a4b7a
is recommended to be not more than 80 characters, including comments.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
C
Packit Service 8a4b7a
=
Packit Service 8a4b7a
Packit Service 8a4b7a
Formatting using checkpatch.pl
Packit Service 8a4b7a
==============================
Packit Service 8a4b7a
Packit Service 8a4b7a
To format your code please use checkpatch.pl script (version 0.32) from
Packit Service 8a4b7a
Linux kernel
Packit Service 8a4b7a
(https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl).
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Indentation
Packit Service 8a4b7a
===========
Packit Service 8a4b7a
Packit Service 8a4b7a
Tabs are 8 characters and thus indentations are also 8 characters.
Packit Service 8a4b7a
It should be consistent within each part of the code. When adding a new file,
Packit Service 8a4b7a
spaces should be used over tabs.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
C Comment Style
Packit Service 8a4b7a
===============
Packit Service 8a4b7a
Packit Service 8a4b7a
Usual Comments
Packit Service 8a4b7a
==============
Packit Service 8a4b7a
Packit Service 8a4b7a
These comments should be used in normal cases. To document a public API,
Packit Service 8a4b7a
a doxygen-like format must be used: refer to Doxygen Guidelines
Packit Service 8a4b7a
(http://www.doxygen.nl/manual/docblocks.html).
Packit Service 8a4b7a
Packit Service 8a4b7a
/*
Packit Service 8a4b7a
 * VERY important single-line comments look like this.
Packit Service 8a4b7a
 */
Packit Service 8a4b7a
Packit Service 8a4b7a
/* Most single-line comments look like this. */
Packit Service 8a4b7a
Packit Service 8a4b7a
/*
Packit Service 8a4b7a
 * Multi-line comments look like this. Make them real sentences. Fill
Packit Service 8a4b7a
 * them so they look like real paragraphs.
Packit Service 8a4b7a
 */
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
License Header
Packit Service 8a4b7a
==============
Packit Service 8a4b7a
Packit Service 8a4b7a
Each file should begin with a special comment containing the appropriate
Packit Service 8a4b7a
copyright and license for the file. Generally this is the BSD License,
Packit Service 8a4b7a
except for code for Linux Kernel modules. After any copyright header,
Packit Service 8a4b7a
a blank line should be left before any other contents, e.g. include statements
Packit Service 8a4b7a
in a C file.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Preprocessor Directives (Header Includes)
Packit Service 8a4b7a
=========================================
Packit Service 8a4b7a
Packit Service 8a4b7a
Include files from the local application directory are included using quotes,
Packit Service 8a4b7a
while includes from other paths are included using angle brackets: “<>”.
Packit Service 8a4b7a
Packit Service 8a4b7a
Example:
Packit Service 8a4b7a
Packit Service 8a4b7a
#include <stdlib.h>
Packit Service 8a4b7a
#include <string.h>
Packit Service 8a4b7a
#include <pthread.h>
Packit Service 8a4b7a
Packit Service 8a4b7a
#include "pqos.h"
Packit Service 8a4b7a
Packit Service 8a4b7a
#include "cap.h"
Packit Service 8a4b7a
#include "allocation.h"
Packit Service 8a4b7a
#include "os_allocation.h"
Packit Service 8a4b7a
Packit Service 8a4b7a
#include "machine.h"
Packit Service 8a4b7a
#include "types.h"
Packit Service 8a4b7a
#include "log.h"
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Header File Guards
Packit Service 8a4b7a
==================
Packit Service 8a4b7a
Packit Service 8a4b7a
Headers should be protected against multiple inclusion with the usual:
Packit Service 8a4b7a
Packit Service 8a4b7a
#ifndef _FILE_H_
Packit Service 8a4b7a
#define _FILE_H_
Packit Service 8a4b7a
Packit Service 8a4b7a
/* Code */
Packit Service 8a4b7a
Packit Service 8a4b7a
#endif /* _FILE_H_ */
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Macros
Packit Service 8a4b7a
======
Packit Service 8a4b7a
Packit Service 8a4b7a
You can define a macro similar in C using #define preprocessor directive.
Packit Service 8a4b7a
Packit Service 8a4b7a
For example:
Packit Service 8a4b7a
Packit Service 8a4b7a
/**
Packit Service 8a4b7a
 * ---------------------------------------
Packit Service 8a4b7a
 * Local macros
Packit Service 8a4b7a
 * ---------------------------------------
Packit Service 8a4b7a
 */
Packit Service 8a4b7a
Packit Service 8a4b7a
/**
Packit Service 8a4b7a
 * Allocation & Monitoring association MSR register
Packit Service 8a4b7a
 * - bits [63..32] QE COS
Packit Service 8a4b7a
 * - bits [31..10] Reserved
Packit Service 8a4b7a
 * - bits [9..0] RMID
Packit Service 8a4b7a
 */
Packit Service 8a4b7a
#define PQOS_MSR_ASSOC             0xC8F
Packit Service 8a4b7a
#define PQOS_MSR_ASSOC_QECOS_SHIFT 32
Packit Service 8a4b7a
#define PQOS_MSR_ASSOC_QECOS_MASK  0xffffffff00000000ULL
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Public APIs in libpqos
Packit Service 8a4b7a
======================
Packit Service 8a4b7a
Packit Service 8a4b7a
All functions that are exposed by the library must have their prototypes
Packit Service 8a4b7a
defined in lib/pqos.h.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Python
Packit Service 8a4b7a
======
Packit Service 8a4b7a
Packit Service 8a4b7a
Python code in this repository except examples has associated .pylintrc
Packit Service 8a4b7a
configuration file for Pylint tool. The code should be rated at 10.0/10.0
Packit Service 8a4b7a
by this linter. Optionally it is allowed to disable some checks in code using
Packit Service 8a4b7a
comments.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Perl
Packit Service 8a4b7a
====
Packit Service 8a4b7a
Packit Service 8a4b7a
Perl code should be checked (and reformatted if necessary) using Perltidy tool.
Packit Service 8a4b7a
These are the recommended flags:
Packit Service 8a4b7a
Packit Service 8a4b7a
-bar - keep the brace on the right even for multiple-line test expressions
Packit Service 8a4b7a
-ce - cuddled else
Packit Service 8a4b7a
-pt=2 - parentheses horizontal tightness - space is never used
Packit Service 8a4b7a
-sbt=2 - square brackets horizontal tightness - space is never used
Packit Service 8a4b7a
-bbt=2 - code block curly braces horizontal tightness - space is never used
Packit Service 8a4b7a
-et=4 - entab leading whitespace with one tab character for each 4 spaces
Packit Service 8a4b7a
-baao - "break after all operators"
Packit Service 8a4b7a
-nsfs - no space before a semicolon in a for statement
Packit Service 8a4b7a
-vtc=1 - do not break before a closing token which is followed by a semicolon
Packit Service 8a4b7a
or another closing token, and is not in a list environment
Packit Service 8a4b7a
-ci=4 - continuation indentation - extra indentation spaces applied when
Packit Service 8a4b7a
a long line is broken, 4 spaces
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Documentation
Packit Service 8a4b7a
=============
Packit Service 8a4b7a
Packit Service 8a4b7a
Please make sure to update documentation when necessary. If not possible
Packit Service 8a4b7a
(e.g. not allowed to edit wiki), propose necessary changes.
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Git Commit Messages
Packit Service 8a4b7a
===================
Packit Service 8a4b7a
Packit Service 8a4b7a
Git commit messages should start with a short 50 character or less summary
Packit Service 8a4b7a
in a single paragraph. Ideally, it should start with a short prefix
Packit Service 8a4b7a
followed by a colon describing which part of the code it modifies
Packit Service 8a4b7a
e.g. "pqos: show supported features".
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Development Workflow
Packit Service 8a4b7a
====================
Packit Service 8a4b7a
Packit Service 8a4b7a
Clone a repository in the usual way, for example:
Packit Service 8a4b7a
Packit Service 8a4b7a
git clone https://github.com/intel/intel-cmt-cat
Packit Service 8a4b7a
Packit Service 8a4b7a
Once your local repository is set up as above, you must use
Packit Service 8a4b7a
the following workflow.
Packit Service 8a4b7a
Packit Service 8a4b7a
Make sure you have the latest upstream changes:
Packit Service 8a4b7a
Packit Service 8a4b7a
git remote update
Packit Service 8a4b7a
git checkout master
Packit Service 8a4b7a
git pull origin master
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Committing a Change
Packit Service 8a4b7a
===================
Packit Service 8a4b7a
Packit Service 8a4b7a
Make your changes, commit them, and submit them for review:
Packit Service 8a4b7a
Packit Service 8a4b7a
git commit -a
Packit Service 8a4b7a
Packit Service 8a4b7a
To see how to create pull requests on GitHub, please refer to "About pull
Packit Service 8a4b7a
requests" help page (https://help.github.com/articles/about-pull-requests/).
Packit Service 8a4b7a
Packit Service 8a4b7a
Note: Please ensure that you have your username and email address set correctly
Packit Service 8a4b7a
to let other developers know about your contribution:
Packit Service 8a4b7a
Packit Service 8a4b7a
git config --global user.name "Firstname Lastname"
Packit Service 8a4b7a
git config --global user.email "your_email@youremail.com"
Packit Service 8a4b7a
Packit Service 8a4b7a
Packit Service 8a4b7a
Licenses
Packit Service 8a4b7a
========
Packit Service 8a4b7a
Packit Service 8a4b7a
The code in this repository is licensed under BSD license (see LICENSE file).