Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.2 KB

README.md

File metadata and controls

62 lines (42 loc) · 1.2 KB

Arena-mobi

Arena created for project mobi-av disponibilized in github to usage

Benchmark

Benchmark using google-benchmark

BenchMark

Tests

Tests using google-test

Test

for compile benchmark and tests

  mkdir build
  cd build
  cmake ..
  make

Usage Arena

  #include "include/arena.hpp"
  
  Arena fast(3*sizeof(int)); // allocate 3 blocks long from an length int
  
  int main( void )
  {
    // requests blocks
    int *p1 = (int*)fast.req(sizeof(int));
    *p1 = 100;

    int *p2 = (int*)fast.req(sizeof(int));
    *p2 = 400;

    int *p3 = (int*)fast.req(sizeof(int));
    *p3 = 400;
    
    return 0;
  }

Functions extras :

void realloc(unsigned int ); // allocate more space in the arena

obs: when you make a request for more space the previously created arena will be completely erased and the requested space will be allocated

void dell(); // will put the pointer to the beginning of the arena
unsigned int fquantity(); // will bring the value of available space in the arena

Diagrama

arenaDigrama