Flow123d  JS_before_hm-2154-g185f171e0
Classes | Macros | Typedefs | Functions
memory.cc File Reference
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <chrono>
#include <iostream>
#include <fstream>
#include <stdarg.h>
#include "libs/json.hpp"

Go to the source code of this file.

Classes

class  Timer
 

Macros

#define KB   1024
 
#define MB   1048576
 
#define REP   (MB * 3)
 
#define OFFSET   256
 
#define ARR_SIZE   (MB * 100)
 
#define GIGA   1.0e+9
 
#define MEGA   1.0e+6
 
#define KILO   1.0e+3
 
#define MILI   1.0e-3
 
#define MICRO   1.0e-6
 
#define NANO   1.0e-9
 
#define CHAR_SIZE   sizeof(char)
 
#define INT_SIZE   sizeof(int)
 
#define SHOW_DURATION   true
 
#define SHOW_DETAILS   true
 

Typedefs

using json = nlohmann::json
 

Functions

void printf_debug (const char *fmt,...)
 
void cpu_test (json &results, int repetition=REP)
 
template<int N, int M>
void cpu_test_r (json &results, int(&arr)[M], int(&sizes)[N], int repetition=REP)
 
template<int N, int M>
void cpu_test_w (json &results, int(&arr)[M], int(&sizes)[N], int repetition=REP)
 
template<int N, int M>
void cpu_test_rw (json &results, int(&arr)[M], int(&sizes)[N], int repetition=REP)
 
template<int N>
void io_test_rw (json &results, int(&sizes)[N], int file_size, const int buffer_size=1 *MB)
 
void io_test_many (json &results, int no_files=KILO)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ ARR_SIZE

#define ARR_SIZE   (MB * 100)

Definition at line 15 of file memory.cc.

◆ CHAR_SIZE

#define CHAR_SIZE   sizeof(char)

Definition at line 24 of file memory.cc.

◆ GIGA

#define GIGA   1.0e+9

Definition at line 17 of file memory.cc.

◆ INT_SIZE

#define INT_SIZE   sizeof(int)

Definition at line 25 of file memory.cc.

◆ KB

#define KB   1024

Definition at line 11 of file memory.cc.

◆ KILO

#define KILO   1.0e+3

Definition at line 19 of file memory.cc.

◆ MB

#define MB   1048576

Definition at line 12 of file memory.cc.

◆ MEGA

#define MEGA   1.0e+6

Definition at line 18 of file memory.cc.

◆ MICRO

#define MICRO   1.0e-6

Definition at line 21 of file memory.cc.

◆ MILI

#define MILI   1.0e-3

Definition at line 20 of file memory.cc.

◆ NANO

#define NANO   1.0e-9

Definition at line 22 of file memory.cc.

◆ OFFSET

#define OFFSET   256

Definition at line 14 of file memory.cc.

◆ REP

#define REP   (MB * 3)

Definition at line 13 of file memory.cc.

◆ SHOW_DETAILS

#define SHOW_DETAILS   true

Definition at line 28 of file memory.cc.

◆ SHOW_DURATION

#define SHOW_DURATION   true

Definition at line 27 of file memory.cc.

Typedef Documentation

◆ json

Definition at line 31 of file memory.cc.

Function Documentation

◆ cpu_test()

void cpu_test ( json results,
int  repetition = REP 
)

Definition at line 58 of file memory.cc.

Here is the caller graph for this function:

◆ cpu_test_r()

template<int N, int M>
void cpu_test_r ( json results,
int(&)  arr[M],
int(&)  sizes[N],
int  repetition = REP 
)

Definition at line 85 of file memory.cc.

Here is the caller graph for this function:

◆ cpu_test_rw()

template<int N, int M>
void cpu_test_rw ( json results,
int(&)  arr[M],
int(&)  sizes[N],
int  repetition = REP 
)

Definition at line 154 of file memory.cc.

Here is the caller graph for this function:

◆ cpu_test_w()

template<int N, int M>
void cpu_test_w ( json results,
int(&)  arr[M],
int(&)  sizes[N],
int  repetition = REP 
)

Definition at line 120 of file memory.cc.

Here is the caller graph for this function:

◆ io_test_many()

void io_test_many ( json results,
int  no_files = KILO 
)

Definition at line 262 of file memory.cc.

Here is the caller graph for this function:

◆ io_test_rw()

template<int N>
void io_test_rw ( json results,
int(&)  sizes[N],
int  file_size,
const int  buffer_size = 1 * MB 
)

Definition at line 188 of file memory.cc.

Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Start benchmark, usage: optional <output> file: will create json file output with results optional <scale> float: scales repetition count for benchmark default is 1, for example value 2 will run tests twice as many times, value 0.5 will experiments half as many times

Definition at line 335 of file memory.cc.

◆ printf_debug()

void printf_debug ( const char *  fmt,
  ... 
)

Definition at line 48 of file memory.cc.

Here is the caller graph for this function: