initialize.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright Institute of Communication and Computer Systems (ICCS)
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. /**
  18. * @file src/initialize.c
  19. * @author Ioannis Koutras (joko@microlab.ntua.gr)
  20. * @date December 2012
  21. * @brief System allocator's global object initializer.
  22. */
  23. #include <dmmlib/config.h>
  24. #include "dmmlib/dmmlib.h"
  25. /** Global variable storing allocator's settings */
  26. allocator_t systemallocator =
  27. { .rb_head = {NULL}
  28. #ifdef WITH_DEBUG
  29. , .bb_head = {NULL}
  30. #endif /* WITH_DEBUG */
  31. #ifdef HAVE_LOCKS
  32. , .creation_mutex = PTHREAD_MUTEX_INITIALIZER
  33. #endif /* HAVE_LOCKS */
  34. #ifdef WITH_KNOBS
  35. , .dmm_knobs =
  36. { .sys_alloc_size = SYS_ALLOC_SIZE
  37. #ifdef GOOD_FIT
  38. , .fit_percentage = GOOD_FIT_PERCENTAGE
  39. #endif /* GOOD_FIT */
  40. #ifdef COALESCING_VARIABLE
  41. , .max_coal_size = MAX_COAL_SIZE
  42. #endif /* COALESCING_VARIABLE */
  43. #ifdef SPLITTING_VARIABLE
  44. , .min_split_size = MIN_SPLIT_SIZE
  45. #endif /* SPLITTING_VARIABLE */
  46. }
  47. #endif /* WITH_KNOBS */
  48. #ifdef WITH_ALLOCATOR_STATS
  49. , {
  50. #ifdef REQUEST_SIZE_INFO
  51. 0,
  52. #endif /* REQUEST_SIZE_INFO */
  53. 0
  54. , 0
  55. , 0
  56. , 0
  57. , 0
  58. }
  59. #endif /* WITH_ALLOCATOR_STATS */
  60. #ifdef PARSE_ENV
  61. #if defined WITH_MEM_TRACE || defined WITH_STATS_TRACE || defined WITH_DEBUG
  62. , .initialized = false
  63. #endif /* WITH_MEM_TRACE || WITH_STATS_TRACE || WITH_DEBUG */
  64. #endif /* PARSE_ENV */
  65. };