Skip to content

Commit

Permalink
Fix the README and update coverage measurement (#10)
Browse files Browse the repository at this point in the history
* Update README as suggested in https://github.com/pavel-kirienko/o1heap/issues/4\#issuecomment-948071875

* Update CI configuration

* Enable sonarcloud on push, too
  • Loading branch information
pavel-kirienko authored Oct 21, 2021
1 parent 9daa66d commit 4616230
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
run: make test

sonarcloud:
if: endsWith(github.base_ref, 'master') || endsWith(github.ref, 'master')
runs-on: ubuntu-latest
env:
SONAR_SCANNER_VERSION: 4.6.1.2450
Expand Down Expand Up @@ -87,14 +86,16 @@ jobs:
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
# Pass NDEBUG to exclude assert() from coverage; see https://github.com/pavel-kirienko/o1heap/issues/9
- name: Run build-wrapper
run: |
cmake tests -DCMAKE_BUILD_TYPE=Debug -DNO_STATIC_ANALYSIS=1
cmake tests -DCMAKE_BUILD_TYPE=Debug -DNO_STATIC_ANALYSIS=1 -DCMAKE_C_FLAGS='-DNDEBUG=1'
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make all
make test
gcov --preserve-paths --long-file-names $(find CMakeFiles/test_general_cov.dir -name '*.gcno')
gcov --preserve-paths --long-file-names $(find CMakeFiles/test_private_cov.dir -name '*.gcno')
# https://community.sonarsource.com/t/analyzing-a-header-only-c-library/51468
- name: Run sonar-scanner
run: >
sonar-scanner
Expand All @@ -105,9 +106,10 @@ jobs:
--define sonar.cfamily.gcov.reportsPath="."
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
--define sonar.cfamily.cache.enabled="false"
--define sonar.cfamily.threads=1
--define sonar.cfamily.threads=2
--define sonar.host.url="${{ env.SONAR_SERVER_URL }}"
--define sonar.login=${{ secrets.SONAR_TOKEN }}
$([ -z "$GITHUB_BASE_REF" ] && echo "--define sonar.branch.name=${GITHUB_REF##*/}" || true)
style_check:
runs-on: ubuntu-latest
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# O(1) heap

[![Main Workflow](https://github.com/pavel-kirienko/o1heap/actions/workflows/main.yml/badge.svg)](https://github.com/pavel-kirienko/o1heap/actions/workflows/main.yml)
[![Build Status](https://travis-ci.org/pavel-kirienko/o1heap.svg?branch=master)](https://travis-ci.org/pavel-kirienko/o1heap)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=pavel-kirienko_o1heap&metric=coverage)](https://sonarcloud.io/dashboard?id=pavel-kirienko_o1heap)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=pavel-kirienko_o1heap&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=pavel-kirienko_o1heap)

O1heap is a highly deterministic constant-complexity memory allocator designed for
Expand Down Expand Up @@ -159,10 +159,6 @@ No special compiler options are needed to compile the source file (if you find t

Dedicate a memory arena for the heap, and pass a pointer to it along with its size to the initialization function
`o1heapInit(..)`.
In the case of concurrent environments, also pass pointers to the synchronization locking/unlocking functions
-- they will be invoked by the library to facilitate atomic transactions.
Alternatively, some applications (where possible) might benefit from using a separate heap per thread to avoid
the synchronization overhead and reduce contention.

Allocate and deallocate memory using `o1heapAllocate(..)` and `o1heapFree(..)`.
Their semantics are compatible with `malloc(..)` and `free(..)` plus additional behavioral guarantees
Expand All @@ -171,6 +167,8 @@ Their semantics are compatible with `malloc(..)` and `free(..)` plus additional
If necessary, periodically invoke `o1heapDoInvariantsHold(..)` to ensure that the heap is functioning correctly
and its internal data structures are not damaged.

Avoid concurrent access to the heap. Use locking if necessary.

### Build configuration options

The preprocessor options given below can be overridden to fine-tune the implementation.
Expand Down

0 comments on commit 4616230

Please sign in to comment.