Skip to content

Commit

Permalink
In test mode, cpp github action is using malloc allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe0606 committed Jun 26, 2024
1 parent 4bee30f commit 2c81ccd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dsppp/allocator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "allocator.h"

#if !defined(TESTMODE)

#define ALLOC_POOL(BYTES,NB) \
MemoryPool<POOL_BLOCK_##BYTES,user_allocator_aligned_malloc> vecPool_##BYTES(NB);

Expand All @@ -11,11 +13,13 @@ std::map<int, int> current_stats;
std::map<int, int> max_stats;
std::map<void*, std::size_t> current_dyn_stats;

#endif

void print_map(std::string comment)
{

std::cout << comment << "\r\n";
#if !defined(POOL_ALLOCATOR)
#if !defined(POOL_ALLOCATOR) && !defined(TESTMODE)
std::size_t total_static=0;
std::size_t total_dynamic=0;

Expand Down Expand Up @@ -64,6 +68,8 @@ void print_map(std::string comment)
#endif
}

#if !defined(TESTMODE)

void reset_current_stats()
{
#if !defined(POOL_ALLOCATOR)
Expand Down Expand Up @@ -96,3 +102,4 @@ void check_current_stats()
#endif
}

#endif
7 changes: 6 additions & 1 deletion dsppp/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct pool_allocator<BYTES> {
};


#if !defined(TESTMODE)
#if defined(POOL_ALLOCATOR)
#include "allocation/all.h"
#endif
Expand Down Expand Up @@ -122,6 +123,10 @@ struct stat_allocator {

};

extern void print_map(std::string comment);
extern void check_current_stats();
extern void reset_current_stats();

#endif

extern void print_map(std::string comment);

1 change: 0 additions & 1 deletion dsppp/test.csolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ solution:

packs:
- pack: ARM::CMSIS@6.0.0
- pack: ARM::CMSIS-DSP@1.15.0
- pack: ARM::V2M_MPS3_SSE_300_BSP@1.4.0
- pack: ARM::CMSIS-Compiler@2.0.0
- pack: ARM::Cortex_DFP@1.0.0
Expand Down
8 changes: 8 additions & 0 deletions dsppp/tests/common_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ using namespace arm_cmsis_dsp;
*
*/

#if defined(TESTMODE)
template<typename P,int L=arm_cmsis_dsp::DYNAMIC>
using PVector = Vector<P,L,malloc_allocator>;

template<typename P,int R=arm_cmsis_dsp::DYNAMIC,int C=arm_cmsis_dsp::DYNAMIC>
using PMat = Matrix<P,R,C,malloc_allocator>;

#else
#if defined(POOL_ALLOCATOR)

template<typename P,int L=arm_cmsis_dsp::DYNAMIC>
Expand All @@ -43,6 +50,7 @@ using namespace arm_cmsis_dsp;
using PMat = Matrix<P,R,C,stat_allocator>;

#endif
#endif

template<typename P,int stride=1>
using PView = VectorView<P,stride>;
Expand Down

0 comments on commit 2c81ccd

Please sign in to comment.