rambrain
rambrainconfig.cpp
Go to the documentation of this file.
1 /* rambrain - a dynamical physical memory extender
2  * Copyright (C) 2015 M. Imgrund, A. Arth
3  * mimgrund (at) mpifr-bonn.mpg.de
4  * arth (at) usm.uni-muenchen.de
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "rambrainconfig.h"
21 
22 #include "common.h"
23 #include "managedDummySwap.h"
24 #include "managedFileSwap.h"
25 #include "cyclicManagedMemory.h"
26 #include "dummyManagedMemory.h"
27 #include "exceptions.h"
28 #include "git_info.h"
29 
30 namespace rambrain
31 {
32 namespace rambrainglobals
33 {
34 
36 {
37  infomsgf ( "Greetings from Rambrain!\n\tRambrain is still in an early stage of development. Please report any strange behaviour!\n\tRambrain was compiled from git %s\tWhen reporting problems, please include this commit number.", gitCommit );
38  init();
39 }
40 
42 {
43  clean();
44 }
45 
46 void rambrainConfig::reinit ( bool reread )
47 {
48  clean();
49  if ( reread ) {
50  config.setReread();
51  }
52  init();
53 }
54 
56 {
58  c.memory.value = memory;
59  manager->setMemoryLimit ( memory );
60 }
61 
63 {
65  c.swapMemory.value = memory;
66  reinit ( false );
67 }
68 
70 {
71  const configuration &c = getConfig();
72 
73  if ( c.swap.value == "managedDummySwap" ) {
75  } else if ( c.swap.value == "managedFileSwap" ) {
76  swap = new managedFileSwap ( c.swapMemory.value, c.swapfiles.value.c_str(), 0, c.enableDMA.value );
78  }
79 
80  if ( c.memoryManager.value == "dummyManagedMemory" ) {
81  manager = new dummyManagedMemory ( );
82  } else if ( c.memoryManager.value == "cyclicManagedMemory" ) {
84  }
85 }
86 
87 
89 {
90  delete manager;
91  manager = NULL;
92  delete swap;
93  swap = NULL;
94 }
95 
96 }
97 }
98 
void resizeMemory(global_bytesize memory)
Simple setter.
void resizeSwap(global_bytesize memory)
Simple setter.
const configuration & getConfig()
Simple getter.
configLine< swapPolicy > policy
Definition: configreader.h:141
configLine< bool > enableDMA
Definition: configreader.h:140
~rambrainConfig()
Destructs the throught the config initiated swap and manager.
An implementation of managedSwap that is capable of kernel asynchronousIO.
uint64_t global_bytesize
Definition: common.h:65
configLine< string > swapfiles
Definition: configreader.h:138
configuration & getConfig()
Simple getter.
Definition: configreader.h:192
Main struct to save configuration variables.
Definition: configreader.h:131
rambrainConfig()
Construct a new config handling class.
const unsigned char gitCommit[]
Definition: git_info.h:1
void setReread()
Simple setter.
Definition: configreader.h:208
void reinit(bool reread=true)
Reinitialises the system.
configLine< global_bytesize > memory
Definition: configreader.h:139
configLine< string > swap
Definition: configreader.h:138
a dummy managed Memory that basically does nothing and throws on everything.
scheduler working with a double linked cycle. Details see paper.
virtual swapPolicy setSwapPolicy(swapPolicy newPolicy)
Definition: managedSwap.h:100
bool setMemoryLimit(global_bytesize size)
dynamically adjusts allowed ram usage
configLine< string > memoryManager
Definition: configreader.h:138
A dummy swap that just copies swapped out chunks to a different location in ram.
configLine< global_bytesize > swapMemory
Definition: configreader.h:139