Changeset 34952
- Timestamp:
- 08/20/09 22:02:35 (4 years ago)
- Location:
- lang/objective-cplusplus/i3/trunk
- Files:
-
- 5 modified
-
src/mil/include/mil/Memory.h (modified) (5 diffs)
-
src/mil/include/mil/StaticData.cpp (modified) (1 diff)
-
src/mil/src/Test11.cpp (modified) (3 diffs)
-
src/os-windows/Pty.cpp (modified) (1 diff)
-
windows/mil_test.vcproj (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/Memory.h
r34852 r34952 82 82 MemoryList* memory; 83 83 }; 84 85 #define MIL_MALLOC_PRODUCERioioioio 84 } 85 } 86 87 #define MIL_MALLOC_PRODUCERooo 88 #define MIL_TBB_PRODUCERooo 89 86 90 #ifdef MIL_MALLOC_PRODUCER 87 91 namespace mil { 92 namespace pool { 88 93 class Producer { 89 94 public: … … 115 120 } 116 121 }; 117 118 #elif MIL_TBB_PRODUCER 122 } 123 } 124 #elif defined(MIL_TBB_PRODUCER) 125 #include <tbb/scalable_allocator.h> 126 namespace mil { 127 namespace pool { 128 struct TbbMemoryUnit { 129 char data[BLOCK_SIZE]; 130 }; 131 extern tbb::scalable_allocator<TbbMemoryUnit> tbb_allocator; 132 class Producer { 133 public: 134 Producer() { 135 } 136 Producer(intptr_t) { 137 } 138 template <int BYTES> 139 void* malloc() { 140 int blocks = Bytes2Blocks<BYTES>::value; 141 if (blocks > MALLOC_BLOCKS_THESHOLD) { 142 return ::malloc(BYTES); 143 } else { 144 return tbb_allocator.allocate(blocks); 145 } 146 } 147 void free(void*, int) { 148 halt << "free2()"; 149 } 150 void free(MemoryList*) { 151 halt << "free()"; 152 } 153 }; 154 155 class Consumer { 156 public: 157 MemoryList* pop(int) { 158 return NULL; 159 } 160 161 template <class T> 162 void store(T* mem) { 163 size_t blocks = pool::bytes_to_blocks(return_memory_considered_sizeof<T>()); 164 if (blocks > (size_t)MALLOC_BLOCKS_THESHOLD) { 165 ::free((void*)mem); 166 } else { 167 tbb_allocator.deallocate((mil::pool::TbbMemoryUnit*)mem, blocks); 168 } 169 } 170 }; 171 } 172 } 119 173 #else 120 174 namespace mil { 175 namespace pool { 121 176 #define MIL_DEBUG_PRODUCERiii 122 177 … … 215 270 216 271 enum { 217 MAX_STORES = 20,272 MAX_STORES = 30, 218 273 }; 219 274 … … 254 309 } 255 310 }; 256 311 } 312 } 257 313 #endif // MIL_MALLOC_PRODUCER, MIL_TBB_PRODUCER 258 314 … … 278 334 }; 279 335 */ 280 281 }282 }283 284 -
lang/objective-cplusplus/i3/trunk/src/mil/include/mil/StaticData.cpp
r34863 r34952 17 17 18 18 namespace mil { 19 #ifdef MIL_TBB_PRODUCER 20 namespace pool { 21 tbb::scalable_allocator<TbbMemoryUnit> tbb_allocator; 22 } 23 #endif 19 24 20 25 namespace thread { -
lang/objective-cplusplus/i3/trunk/src/mil/src/Test11.cpp
r34865 r34952 37 37 38 38 // bench class 39 const unsigned int POST_MAX = 2000 ;39 const unsigned int POST_MAX = 200000; 40 40 const unsigned int NUM_THREADS = 19; 41 41 … … 77 77 } 78 78 void execute(AllPosted& e) { 79 //printf("AllPosted Received : %lf, global = %d, index = %d\n",80 //(double)(clock() - begin) / CLOCKS_PER_SEC, global.load(), index);79 printf("AllPosted Received : %lf, global = %d, index = %d\n", 80 (double)(clock() - begin) / CLOCKS_PER_SEC, global.load(), index); 81 81 spin_status.fetch_and_add(1); 82 82 } … … 142 142 #endif 143 143 144 for (int i = 0; i < 5 0; i++) {144 for (int i = 0; i < 5; i++) { 145 145 n_times(); 146 //puts("---");146 puts("---"); 147 147 } 148 148 } -
lang/objective-cplusplus/i3/trunk/src/os-windows/Pty.cpp
r34947 r34952 41 41 42 42 Pty::~Pty() { 43 interrupt();43 //interrupt(); 44 44 write("exit\n"); 45 45 } -
lang/objective-cplusplus/i3/trunk/windows/mil_test.vcproj
r34940 r34952 919 919 </File> 920 920 <File 921 RelativePath="..\src\mil\src\Test1.cpp"922 >923 </File>924 <File925 RelativePath="..\src\mil\src\Test10.cpp"926 >927 </File>928 <File929 921 RelativePath="..\src\mil\src\Test11.cpp" 930 >931 </File>932 <File933 RelativePath="..\src\mil\src\Test12.cpp"934 >935 </File>936 <File937 RelativePath="..\src\mil\src\Test2.cpp"938 >939 </File>940 <File941 RelativePath="..\src\mil\src\Test3.cpp"942 >943 </File>944 <File945 RelativePath="..\src\mil\src\Test4.cpp"946 >947 </File>948 <File949 RelativePath="..\src\mil\src\Test5.cpp"950 >951 </File>952 <File953 RelativePath="..\src\mil\src\Test6.cpp"954 >955 </File>956 <File957 RelativePath="..\src\mil\src\Test7.cpp"958 >959 </File>960 <File961 RelativePath="..\src\mil\src\Test8.cpp"962 >963 </File>964 <File965 RelativePath="..\src\mil\src\Test9.cpp"966 922 > 967 923 </File> … … 978 934 </FileConfiguration> 979 935 </File> 980 <File981 RelativePath="..\src\mil\src\windows\WindowProcedureTest.cpp"982 >983 </File>984 936 </Filter> 985 937 <Filter … … 997 949 </File> 998 950 <File 951 RelativePath="..\src\mil\include\mil\os-windows\Debug.h" 952 > 953 </File> 954 <File 999 955 RelativePath="..\src\mil\include\mil\Debug.h" 1000 956 > 1001 957 </File> 1002 958 <File 1003 RelativePath="..\src\mil\include\mil\os-windows\Debug.h"1004 >1005 </File>1006 <File1007 959 RelativePath="..\src\mil\include\mil\gui-windows\DummyMessageHandler-inl.h" 1008 960 > … … 1017 969 </File> 1018 970 <File 971 RelativePath="..\src\mil\include\mil\gui-windows\GuiModule.h" 972 > 973 </File> 974 <File 1019 975 RelativePath="..\src\mil\include\mil\GuiModule.h" 1020 976 > 1021 977 </File> 1022 978 <File 1023 RelativePath="..\src\mil\include\mil\gui-windows\GuiModule.h"1024 >1025 </File>1026 <File1027 979 RelativePath="..\src\mil\include\mil\Memory.h" 1028 980 > … … 1053 1005 </File> 1054 1006 <File 1007 RelativePath="..\src\mil\include\mil\gui-windows\PrecompiledHeaders.h" 1008 > 1009 </File> 1010 <File 1011 RelativePath="..\src\mil\include\mil\os-windows\PrecompiledHeaders.h" 1012 > 1013 </File> 1014 <File 1055 1015 RelativePath="..\src\mil\include\mil\PrecompiledHeaders.h" 1056 1016 > 1057 1017 </File> 1058 1018 <File 1059 RelativePath="..\src\mil\include\mil\gui-windows\PrecompiledHeaders.h"1060 >1061 </File>1062 <File1063 RelativePath="..\src\mil\include\mil\os-windows\PrecompiledHeaders.h"1064 >1065 </File>1066 <File1067 1019 RelativePath="..\src\mil\include\quicktest\quicktest.h" 1068 1020 > … … 1081 1033 </File> 1082 1034 <File 1035 RelativePath="..\src\mil\include\mil\Thread.h" 1036 > 1037 </File> 1038 <File 1083 1039 RelativePath="..\src\mil\include\mil\os-windows\Thread.h" 1084 >1085 </File>1086 <File1087 RelativePath="..\src\mil\include\mil\Thread.h"1088 1040 > 1089 1041 </File>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)