Generated on Tue Apr 18 10:22:06 2017 for Gecode by doxygen 1.6.3

memory-config.hpp

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Bugfixes provided by:
00007  *     Zandra Norman
00008  *
00009  *  Copyright:
00010  *     Christian Schulte, 2008
00011  *
00012  *  Last modified:
00013  *     $Date: 2013-07-08 17:25:13 +0200 (Mon, 08 Jul 2013) $ by $Author: schulte $
00014  *     $Revision: 13825 $
00015  *
00016  *  This file is part of Gecode, the generic constraint
00017  *  development environment:
00018  *     http://www.gecode.org
00019  *
00020  *  Permission is hereby granted, free of charge, to any person obtaining
00021  *  a copy of this software and associated documentation files (the
00022  *  "Software"), to deal in the Software without restriction, including
00023  *  without limitation the rights to use, copy, modify, merge, publish,
00024  *  distribute, sublicense, and/or sell copies of the Software, and to
00025  *  permit persons to whom the Software is furnished to do so, subject to
00026  *  the following conditions:
00027  *
00028  *  The above copyright notice and this permission notice shall be
00029  *  included in all copies or substantial portions of the Software.
00030  *
00031  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00032  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00033  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00034  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00035  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00036  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00037  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00038  *
00039  */
00040 
00041 namespace Gecode {
00042 
00047   namespace MemoryConfig {
00051     const unsigned int n_hc_cache = 4*4;
00052 
00056     const size_t hcsz_min =  1024;
00064     const size_t hcsz_max = 32 * 1024;
00071     const int hcsz_inc_ratio = 8;
00081     const int hcsz_dec_ratio = 8;
00082 
00094     const int fl_unit_size = ((sizeof(void*) == 4) ? 2 : 3);
00103     const int fl_size_min  = ((sizeof(void*) == 4) ? 2 : 2);
00112     const int fl_size_max  = ((sizeof(void*) == 4) ? 3 : 3);
00120     const int fl_refill = 8;
00128 #ifndef GECODE_MEMORY_ALIGNMENT
00129 #define GECODE_MEMORY_ALIGNMENT 8
00130 #endif
00131 
00138     const size_t region_area_size = 32 * 1024;
00139 
00141     void align(size_t& s);
00142 
00143     /*
00144      * Alignment
00145      *
00146      */
00147     forceinline void
00148     align(size_t& s) {
00149       s += ((GECODE_MEMORY_ALIGNMENT -
00150              (s & (GECODE_MEMORY_ALIGNMENT - 1))) &
00151             (GECODE_MEMORY_ALIGNMENT - 1));
00152     }
00153 
00154   }
00155 }
00156 
00157 // STATISTICS: kernel-memory