Committing svn revision 41176: Merged [40330] [40690] [40693] [40779] [40871] [40898] [41049] [41050] [41059] : Fixes ZCP-11457
john
11 years ago
215 | 215 | { "list-companyquota-recipients", 0, NULL, OPT_LIST_CQUOTA_RECIPIENT }, |
216 | 216 | { "purge-softdelete", 1, NULL, OPT_PURGE_SOFTDELETE }, |
217 | 217 | { "purge-deferred", 0, NULL, OPT_PURGE_DEFERRED }, |
218 | { "clear-cache", 0, NULL, OPT_CLEAR_CACHE }, | |
218 | { "clear-cache", 2, NULL, OPT_CLEAR_CACHE }, | |
219 | 219 | { "config", 1, NULL, OPT_CONFIG }, |
220 | 220 | { "utf8", 0, NULL, OPT_UTF8 }, |
221 | 221 | { "force-resync", 0, NULL, OPT_FORCE_RESYNC }, |
2460 | 2460 | IMAPIFolder *lpDeletedStoresFolder = NULL; |
2461 | 2461 | IMAPIFolder *lpRootFolder = NULL; |
2462 | 2462 | ULONG ulObjType = 0; |
2463 | ULONG ulCachePurgeMode = PURGE_CACHE_ALL; | |
2463 | 2464 | |
2464 | 2465 | InputValidator validateInput; |
2465 | 2466 | |
2727 | 2728 | break; |
2728 | 2729 | case OPT_CLEAR_CACHE: |
2729 | 2730 | mode = MODE_CLEAR_CACHE; |
2731 | if (my_optarg) | |
2732 | ulCachePurgeMode = strtol(my_optarg, NULL, 0); | |
2730 | 2733 | break; |
2731 | 2734 | case OPT_PURGE_DEFERRED: |
2732 | 2735 | mode = MODE_PURGE_DEFERRED; |
4211 | 4214 | cout << "Softdelete purge done." << endl; |
4212 | 4215 | break; |
4213 | 4216 | case MODE_CLEAR_CACHE: |
4214 | hr = lpServiceAdmin->PurgeCache(PURGE_CACHE_ALL); | |
4217 | hr = lpServiceAdmin->PurgeCache(ulCachePurgeMode); | |
4215 | 4218 | if (hr != hrSuccess) { |
4216 | 4219 | cerr << "Cache clear failed" << endl; |
4217 | 4220 | goto exit; |
4218 | 4221 | } |
4219 | cout << "Cache cleared." << endl; | |
4222 | if (ulCachePurgeMode != PURGE_CACHE_ALL) { | |
4223 | cout << "Cache cleared with flags " << ulCachePurgeMode << endl; | |
4224 | } else { | |
4225 | cout << "Cache cleared." << endl; | |
4226 | } | |
4220 | 4227 | break; |
4221 | 4228 | case MODE_PURGE_DEFERRED: |
4222 | 4229 | while(1) { |
149 | 149 | |
150 | 150 | size_type Size() const |
151 | 151 | { |
152 | return (m_map.size() * sizeof(typename _MapType::value_type) + 64) + m_ulSize; | |
152 | // it works with map and hash_map | |
153 | return (m_map.size() * (sizeof(typename _MapType::value_type) + sizeof(_MapType) )) + m_ulSize; | |
153 | 154 | } |
154 | 155 | |
155 | 156 | ECRESULT RemoveCacheItem(const key_type &key) |
164 | 165 | } |
165 | 166 | |
166 | 167 | m_ulSize -= GetCacheAdditionalSize(iter->second); |
168 | m_ulSize -= GetCacheAdditionalSize(key); | |
167 | 169 | m_map.erase(iter); |
168 | 170 | |
169 | 171 | exit: |
247 | 249 | } else { |
248 | 250 | // We just inserted a new entry. |
249 | 251 | m_ulSize += GetCacheAdditionalSize(value); |
252 | m_ulSize += GetCacheAdditionalSize(key); | |
250 | 253 | |
251 | 254 | result.first->second.ulLastAccess = GetProcessTime(); |
252 | 255 | |
289 | 292 | iterMap = iterEntry->key; |
290 | 293 | |
291 | 294 | m_ulSize -= GetCacheAdditionalSize(iterMap->second); |
295 | m_ulSize -= GetCacheAdditionalSize(iterMap->first); | |
292 | 296 | m_map.erase(iterMap); |
293 | 297 | } |
294 | 298 |
1548 | 1548 | |
1549 | 1549 | pthread_mutex_lock(&mLock); |
1550 | 1550 | |
1551 | ulSize += mapRow.size() * sizeof(ECTableRowMap::value_type); | |
1551 | ulSize += MEMORY_USAGE_MAP(mapRow.size(), ECTableRowMap); | |
1552 | 1552 | |
1553 | 1553 | for(iterRow = mapRow.begin(); iterRow != mapRow.end(); iterRow++) |
1554 | 1554 | ulSize += iterRow->second->GetObjectSize(); |
1555 | 1555 | |
1556 | ulSize += m_mapBookmarks.size() * sizeof(ECBookmarkMap::value_type); | |
1556 | ulSize += MEMORY_USAGE_MAP(m_mapBookmarks.size(), ECBookmarkMap); | |
1557 | 1557 | |
1558 | 1558 | pthread_mutex_unlock(&mLock); |
1559 | 1559 |
237 | 237 | |
238 | 238 | /* Define to 1 if you have the <sys/un.h> header file. */ |
239 | 239 | #undef HAVE_SYS_UN_H |
240 | ||
241 | /* Google TCMalloc available */ | |
242 | #undef HAVE_TCMALLOC | |
240 | 243 | |
241 | 244 | /* Define to 1 if you have the `timegm' function. */ |
242 | 245 | #undef HAVE_TIMEGM |
46 | 46 | * |
47 | 47 | */ |
48 | 48 | |
49 | #define PROJECT_VERSION_SERVER 7,1,4,41175 | |
50 | #define PROJECT_VERSION_SERVER_STR "7,1,4,41175" | |
51 | #define PROJECT_VERSION_CLIENT 7,1,4,41175 | |
52 | #define PROJECT_VERSION_CLIENT_STR "7,1,4,41175" | |
53 | #define PROJECT_VERSION_EXT_STR "7,1,4,41175" | |
54 | #define PROJECT_VERSION_SPOOLER_STR "7,1,4,41175" | |
55 | #define PROJECT_VERSION_GATEWAY_STR "7,1,4,41175" | |
56 | #define PROJECT_VERSION_CALDAV_STR "7,1,4,41175" | |
57 | #define PROJECT_VERSION_DAGENT_STR "7,1,4,41175" | |
58 | #define PROJECT_VERSION_PROFADMIN_STR "7,1,4,41175" | |
59 | #define PROJECT_VERSION_MONITOR_STR "7,1,4,41175" | |
60 | #define PROJECT_VERSION_PASSWD_STR "7,1,4,41175" | |
61 | #define PROJECT_VERSION_FBSYNCER_STR "7,1,4,41175" | |
62 | #define PROJECT_VERSION_SEARCH_STR "7,1,4,41175" | |
63 | #define PROJECT_VERSION_ARCHIVER_STR "7,1,4,41175" | |
49 | #define PROJECT_VERSION_SERVER 7,1,4,41176 | |
50 | #define PROJECT_VERSION_SERVER_STR "7,1,4,41176" | |
51 | #define PROJECT_VERSION_CLIENT 7,1,4,41176 | |
52 | #define PROJECT_VERSION_CLIENT_STR "7,1,4,41176" | |
53 | #define PROJECT_VERSION_EXT_STR "7,1,4,41176" | |
54 | #define PROJECT_VERSION_SPOOLER_STR "7,1,4,41176" | |
55 | #define PROJECT_VERSION_GATEWAY_STR "7,1,4,41176" | |
56 | #define PROJECT_VERSION_CALDAV_STR "7,1,4,41176" | |
57 | #define PROJECT_VERSION_DAGENT_STR "7,1,4,41176" | |
58 | #define PROJECT_VERSION_PROFADMIN_STR "7,1,4,41176" | |
59 | #define PROJECT_VERSION_MONITOR_STR "7,1,4,41176" | |
60 | #define PROJECT_VERSION_PASSWD_STR "7,1,4,41176" | |
61 | #define PROJECT_VERSION_FBSYNCER_STR "7,1,4,41176" | |
62 | #define PROJECT_VERSION_SEARCH_STR "7,1,4,41176" | |
63 | #define PROJECT_VERSION_ARCHIVER_STR "7,1,4,41176" | |
64 | 64 | #define PROJECT_VERSION_DOT_STR "7.1.4" |
65 | 65 | #define PROJECT_SPECIALBUILD "beta" |
66 | #define PROJECT_SVN_REV_STR "41175" | |
66 | #define PROJECT_SVN_REV_STR "41176" | |
67 | 67 | #define PROJECT_VERSION_MAJOR 7 |
68 | 68 | #define PROJECT_VERSION_MINOR 1 |
69 | #define PROJECT_VERSION_REVISION 41175 | |
69 | #define PROJECT_VERSION_REVISION 41176 |
151 | 151 | |
152 | 152 | #define ZARAFA_API |
153 | 153 | |
154 | ||
155 | /** | |
156 | * Memory usage calculation macros | |
157 | */ | |
158 | #define MEMALIGN(x) (((x) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) | |
159 | ||
160 | #define MEMORY_USAGE_MAP(items, map) (items * (sizeof(map) + sizeof(map::value_type))) | |
161 | #define MEMORY_USAGE_LIST(items, list) (items * (MEMALIGN(sizeof(list) + sizeof(list::value_type)))) | |
162 | #define MEMORY_USAGE_HASHMAP(items, map) MEMORY_USAGE_MAP(items, map) | |
163 | #define MEMORY_USAGE_STRING(str) ( (str.capacity() + 1) * sizeof(char) ) | |
164 | #define MEMORY_USAGE_MULTIMAP(items, map) MEMORY_USAGE_MAP(items, map) | |
165 | ||
166 | ||
154 | 167 | #endif // PLATFORM_H |
978 | 978 | enable_release |
979 | 979 | enable_unicode |
980 | 980 | enable_tcmalloc |
981 | enable_tcmalloc_full | |
981 | 982 | enable_sparsehash |
982 | 983 | with_distro |
983 | 984 | enable_oss |
1662 | 1663 | --enable-release enable release mode (compile flags -O2 and no DEBUG |
1663 | 1664 | defines) |
1664 | 1665 | --enable-unicode enable unicode mode (compile flags -DUNICODE) |
1665 | --enable-tcmalloc enable use of tcmalloc lib | |
1666 | --enable-tcmalloc enable use of tcmalloc minimal lib | |
1667 | --enable-tcmalloc-full enable use of tcmalloc full lib | |
1666 | 1668 | --enable-sparsehash enable use of sparsehash |
1667 | 1669 | --enable-oss enable opensource mode |
1668 | 1670 | --enable-debug enable debug mode (Adds debug code) |
5154 | 5156 | else |
5155 | 5157 | lt_cv_nm_interface="BSD nm" |
5156 | 5158 | echo "int some_variable = 0;" > conftest.$ac_ext |
5157 | (eval echo "\"\$as_me:5158: $ac_compile\"" >&5) | |
5159 | (eval echo "\"\$as_me:5160: $ac_compile\"" >&5) | |
5158 | 5160 | (eval "$ac_compile" 2>conftest.err) |
5159 | 5161 | cat conftest.err >&5 |
5160 | (eval echo "\"\$as_me:5161: $NM \\\"conftest.$ac_objext\\\"\"" >&5) | |
5162 | (eval echo "\"\$as_me:5163: $NM \\\"conftest.$ac_objext\\\"\"" >&5) | |
5161 | 5163 | (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) |
5162 | 5164 | cat conftest.err >&5 |
5163 | (eval echo "\"\$as_me:5164: output\"" >&5) | |
5165 | (eval echo "\"\$as_me:5166: output\"" >&5) | |
5164 | 5166 | cat conftest.out >&5 |
5165 | 5167 | if $GREP 'External.*some_variable' conftest.out > /dev/null; then |
5166 | 5168 | lt_cv_nm_interface="MS dumpbin" |
6366 | 6368 | ;; |
6367 | 6369 | *-*-irix6*) |
6368 | 6370 | # Find out which ABI we are using. |
6369 | echo '#line 6370 "configure"' > conftest.$ac_ext | |
6371 | echo '#line 6372 "configure"' > conftest.$ac_ext | |
6370 | 6372 | if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 |
6371 | 6373 | (eval $ac_compile) 2>&5 |
6372 | 6374 | ac_status=$? |
7865 | 7867 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
7866 | 7868 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
7867 | 7869 | -e 's:$: $lt_compiler_flag:'` |
7868 | (eval echo "\"\$as_me:7869: $lt_compile\"" >&5) | |
7870 | (eval echo "\"\$as_me:7871: $lt_compile\"" >&5) | |
7869 | 7871 | (eval "$lt_compile" 2>conftest.err) |
7870 | 7872 | ac_status=$? |
7871 | 7873 | cat conftest.err >&5 |
7872 | echo "$as_me:7873: \$? = $ac_status" >&5 | |
7874 | echo "$as_me:7875: \$? = $ac_status" >&5 | |
7873 | 7875 | if (exit $ac_status) && test -s "$ac_outfile"; then |
7874 | 7876 | # The compiler can only warn and ignore the option if not recognized |
7875 | 7877 | # So say no if there are warnings other than the usual output. |
8204 | 8206 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
8205 | 8207 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
8206 | 8208 | -e 's:$: $lt_compiler_flag:'` |
8207 | (eval echo "\"\$as_me:8208: $lt_compile\"" >&5) | |
8209 | (eval echo "\"\$as_me:8210: $lt_compile\"" >&5) | |
8208 | 8210 | (eval "$lt_compile" 2>conftest.err) |
8209 | 8211 | ac_status=$? |
8210 | 8212 | cat conftest.err >&5 |
8211 | echo "$as_me:8212: \$? = $ac_status" >&5 | |
8213 | echo "$as_me:8214: \$? = $ac_status" >&5 | |
8212 | 8214 | if (exit $ac_status) && test -s "$ac_outfile"; then |
8213 | 8215 | # The compiler can only warn and ignore the option if not recognized |
8214 | 8216 | # So say no if there are warnings other than the usual output. |
8309 | 8311 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
8310 | 8312 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
8311 | 8313 | -e 's:$: $lt_compiler_flag:'` |
8312 | (eval echo "\"\$as_me:8313: $lt_compile\"" >&5) | |
8314 | (eval echo "\"\$as_me:8315: $lt_compile\"" >&5) | |
8313 | 8315 | (eval "$lt_compile" 2>out/conftest.err) |
8314 | 8316 | ac_status=$? |
8315 | 8317 | cat out/conftest.err >&5 |
8316 | echo "$as_me:8317: \$? = $ac_status" >&5 | |
8318 | echo "$as_me:8319: \$? = $ac_status" >&5 | |
8317 | 8319 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
8318 | 8320 | then |
8319 | 8321 | # The compiler can only warn and ignore the option if not recognized |
8364 | 8366 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
8365 | 8367 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
8366 | 8368 | -e 's:$: $lt_compiler_flag:'` |
8367 | (eval echo "\"\$as_me:8368: $lt_compile\"" >&5) | |
8369 | (eval echo "\"\$as_me:8370: $lt_compile\"" >&5) | |
8368 | 8370 | (eval "$lt_compile" 2>out/conftest.err) |
8369 | 8371 | ac_status=$? |
8370 | 8372 | cat out/conftest.err >&5 |
8371 | echo "$as_me:8372: \$? = $ac_status" >&5 | |
8373 | echo "$as_me:8374: \$? = $ac_status" >&5 | |
8372 | 8374 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
8373 | 8375 | then |
8374 | 8376 | # The compiler can only warn and ignore the option if not recognized |
10748 | 10750 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
10749 | 10751 | lt_status=$lt_dlunknown |
10750 | 10752 | cat > conftest.$ac_ext <<_LT_EOF |
10751 | #line 10752 "configure" | |
10753 | #line 10754 "configure" | |
10752 | 10754 | #include "confdefs.h" |
10753 | 10755 | |
10754 | 10756 | #if HAVE_DLFCN_H |
10844 | 10846 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
10845 | 10847 | lt_status=$lt_dlunknown |
10846 | 10848 | cat > conftest.$ac_ext <<_LT_EOF |
10847 | #line 10848 "configure" | |
10849 | #line 10850 "configure" | |
10848 | 10850 | #include "confdefs.h" |
10849 | 10851 | |
10850 | 10852 | #if HAVE_DLFCN_H |
14523 | 14525 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
14524 | 14526 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
14525 | 14527 | -e 's:$: $lt_compiler_flag:'` |
14526 | (eval echo "\"\$as_me:14527: $lt_compile\"" >&5) | |
14528 | (eval echo "\"\$as_me:14529: $lt_compile\"" >&5) | |
14527 | 14529 | (eval "$lt_compile" 2>conftest.err) |
14528 | 14530 | ac_status=$? |
14529 | 14531 | cat conftest.err >&5 |
14530 | echo "$as_me:14531: \$? = $ac_status" >&5 | |
14532 | echo "$as_me:14533: \$? = $ac_status" >&5 | |
14531 | 14533 | if (exit $ac_status) && test -s "$ac_outfile"; then |
14532 | 14534 | # The compiler can only warn and ignore the option if not recognized |
14533 | 14535 | # So say no if there are warnings other than the usual output. |
14622 | 14624 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
14623 | 14625 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
14624 | 14626 | -e 's:$: $lt_compiler_flag:'` |
14625 | (eval echo "\"\$as_me:14626: $lt_compile\"" >&5) | |
14627 | (eval echo "\"\$as_me:14628: $lt_compile\"" >&5) | |
14626 | 14628 | (eval "$lt_compile" 2>out/conftest.err) |
14627 | 14629 | ac_status=$? |
14628 | 14630 | cat out/conftest.err >&5 |
14629 | echo "$as_me:14630: \$? = $ac_status" >&5 | |
14631 | echo "$as_me:14632: \$? = $ac_status" >&5 | |
14630 | 14632 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
14631 | 14633 | then |
14632 | 14634 | # The compiler can only warn and ignore the option if not recognized |
14674 | 14676 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
14675 | 14677 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
14676 | 14678 | -e 's:$: $lt_compiler_flag:'` |
14677 | (eval echo "\"\$as_me:14678: $lt_compile\"" >&5) | |
14679 | (eval echo "\"\$as_me:14680: $lt_compile\"" >&5) | |
14678 | 14680 | (eval "$lt_compile" 2>out/conftest.err) |
14679 | 14681 | ac_status=$? |
14680 | 14682 | cat out/conftest.err >&5 |
14681 | echo "$as_me:14682: \$? = $ac_status" >&5 | |
14683 | echo "$as_me:14684: \$? = $ac_status" >&5 | |
14682 | 14684 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
14683 | 14685 | then |
14684 | 14686 | # The compiler can only warn and ignore the option if not recognized |
16110 | 16112 | fi |
16111 | 16113 | |
16112 | 16114 | |
16115 | # Check whether --enable-tcmalloc-full was given. | |
16116 | if test "${enable_tcmalloc_full+set}" = set; then : | |
16117 | enableval=$enable_tcmalloc_full; want_tcmalloc_full=${enableval} | |
16118 | else | |
16119 | want_tcmalloc_full=no | |
16120 | fi | |
16121 | ||
16122 | ||
16113 | 16123 | # Check whether --enable-sparsehash was given. |
16114 | 16124 | if test "${enable_sparsehash+set}" = set; then : |
16115 | 16125 | enableval=$enable_sparsehash; want_sparsehash=${enableval} |
18463 | 18473 | CPPFLAGS=$CPPFLAGS_system |
18464 | 18474 | |
18465 | 18475 | # Check for google perftools tcmalloc availability |
18466 | if test "$want_tcmalloc" = "yes"; then | |
18476 | if test "$want_tcmalloc_full" = "yes"; then | |
18477 | ||
18478 | # Check whether --with-tcmalloc-prefix was given. | |
18479 | if test "${with_tcmalloc_prefix+set}" = set; then : | |
18480 | withval=$with_tcmalloc_prefix; TCMALLOC_PREFIX=${withval} | |
18481 | else | |
18482 | TCMALLOC_PREFIX=/usr/lib | |
18483 | fi | |
18484 | ||
18485 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for open in -ltcmalloc" >&5 | |
18486 | $as_echo_n "checking for open in -ltcmalloc... " >&6; } | |
18487 | if test "${ac_cv_lib_tcmalloc_open+set}" = set; then : | |
18488 | $as_echo_n "(cached) " >&6 | |
18489 | else | |
18490 | ac_check_lib_save_LIBS=$LIBS | |
18491 | LIBS="-ltcmalloc $LIBS" | |
18492 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
18493 | /* end confdefs.h. */ | |
18494 | ||
18495 | /* Override any GCC internal prototype to avoid an error. | |
18496 | Use char because int might match the return type of a GCC | |
18497 | builtin and then its argument prototype would still apply. */ | |
18498 | #ifdef __cplusplus | |
18499 | extern "C" | |
18500 | #endif | |
18501 | char open (); | |
18502 | int | |
18503 | main () | |
18504 | { | |
18505 | return open (); | |
18506 | ; | |
18507 | return 0; | |
18508 | } | |
18509 | _ACEOF | |
18510 | if ac_fn_cxx_try_link "$LINENO"; then : | |
18511 | ac_cv_lib_tcmalloc_open=yes | |
18512 | else | |
18513 | ac_cv_lib_tcmalloc_open=no | |
18514 | fi | |
18515 | rm -f core conftest.err conftest.$ac_objext \ | |
18516 | conftest$ac_exeext conftest.$ac_ext | |
18517 | LIBS=$ac_check_lib_save_LIBS | |
18518 | fi | |
18519 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tcmalloc_open" >&5 | |
18520 | $as_echo "$ac_cv_lib_tcmalloc_open" >&6; } | |
18521 | if test "x$ac_cv_lib_tcmalloc_open" = x""yes; then : | |
18522 | TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc.so" | |
18523 | $as_echo "#define HAVE_TCMALLOC 1" >>confdefs.h | |
18524 | ||
18525 | else | |
18526 | WITH_TCMALLOC=no | |
18527 | fi | |
18528 | ||
18529 | ||
18530 | elif test "$want_tcmalloc" = "yes"; then | |
18467 | 18531 | |
18468 | 18532 | # Check whether --with-tcmalloc-prefix was given. |
18469 | 18533 | if test "${with_tcmalloc_prefix+set}" = set; then : |
18510 | 18574 | $as_echo "$ac_cv_lib_tcmalloc_minimal_open" >&6; } |
18511 | 18575 | if test "x$ac_cv_lib_tcmalloc_minimal_open" = x""yes; then : |
18512 | 18576 | TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc_minimal.a" |
18577 | $as_echo "#define HAVE_TCMALLOC 1" >>confdefs.h | |
18578 | ||
18513 | 18579 | else |
18514 | 18580 | WITH_TCMALLOC=no |
18515 | 18581 | fi |
122 | 122 | ZCXXFLAGS="$ZCXXFLAGS -DUNICODE" |
123 | 123 | fi |
124 | 124 | |
125 | AC_ARG_ENABLE(tcmalloc, AC_HELP_STRING([--enable-tcmalloc],[enable use of tcmalloc lib]), | |
125 | AC_ARG_ENABLE(tcmalloc, AC_HELP_STRING([--enable-tcmalloc],[enable use of tcmalloc minimal lib]), | |
126 | 126 | [want_tcmalloc=${enableval}],[want_tcmalloc=no]) |
127 | ||
128 | AC_ARG_ENABLE(tcmalloc-full, AC_HELP_STRING([--enable-tcmalloc-full],[enable use of tcmalloc full lib]), | |
129 | [want_tcmalloc_full=${enableval}],[want_tcmalloc_full=no]) | |
127 | 130 | |
128 | 131 | AC_ARG_ENABLE(sparsehash, AC_HELP_STRING([--enable-sparsehash],[enable use of sparsehash]), |
129 | 132 | [want_sparsehash=${enableval}],[want_sparsehash=no]) |
476 | 479 | CPPFLAGS=$CPPFLAGS_system |
477 | 480 | |
478 | 481 | # Check for google perftools tcmalloc availability |
479 | if test "$want_tcmalloc" = "yes"; then | |
482 | if test "$want_tcmalloc_full" = "yes"; then | |
483 | AC_ARG_WITH(tcmalloc-prefix, | |
484 | AC_HELP_STRING([--with-tcmalloc-prefix=PATH],[path to tcmalloc lib, e.g. /usr/lib/]), | |
485 | [TCMALLOC_PREFIX=${withval}],[TCMALLOC_PREFIX=/usr/lib]) | |
486 | AC_CHECK_LIB(tcmalloc, [open], | |
487 | [ TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc.so" AC_DEFINE(HAVE_TCMALLOC, [1], [Google TCMalloc available]) ], | |
488 | [ WITH_TCMALLOC=no ]) | |
489 | AC_SUBST(TCMALLOC_LIBS) | |
490 | elif test "$want_tcmalloc" = "yes"; then | |
480 | 491 | AC_ARG_WITH(tcmalloc-prefix, |
481 | 492 | AC_HELP_STRING([--with-tcmalloc-prefix=PATH],[path to tcmalloc lib, e.g. /usr/lib/]), |
482 | 493 | [TCMALLOC_PREFIX=${withval}],[TCMALLOC_PREFIX=/usr/lib]) |
483 | 494 | AC_CHECK_LIB(tcmalloc_minimal, [open], |
484 | [ TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc_minimal.a" ], | |
495 | [ TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc_minimal.a" AC_DEFINE(HAVE_TCMALLOC, [1], [Google TCMalloc available]) ], | |
485 | 496 | [ WITH_TCMALLOC=no ]) |
486 | 497 | AC_SUBST(TCMALLOC_LIBS) |
487 | 498 | else |
2092 | 2092 | any data requested after the cache is cleared needs to be |
2093 | 2093 | re-requested from the database or LDAP server. Normally this |
2094 | 2094 | option is never needed; it is mostly used as a diagnostics |
2095 | tool.</para> | |
2095 | tool.</para> | |
2096 | <para>Optionally use <parameter>--clear-cache=</parameter> to specify a set | |
2097 | of purge options. The following options can be used: | |
2098 | <simplelist type='horiz' columns='1'> | |
2099 | <member>0x0000 Release no longer used memory back to the kernel</member> | |
2100 | <member>0x0001 Purge the quota cache</member> | |
2101 | <member>0x0002 Purge the quota default cache</member> | |
2102 | <member>0x0004 Purge the object cache</member> | |
2103 | <member>0x0008 Purge the store cache</member> | |
2104 | <member>0x0010 Purge the ACL cache</member> | |
2105 | <member>0x0020 Purge the cell cache</member> | |
2106 | <member>0x0040 Purge the index1 cache</member> | |
2107 | <member>0x0080 Purge the index2 cache</member> | |
2108 | <member>0x0100 Purge the indexproperty cache</member> | |
2109 | <member>0x0200 Purge the user object cache</member> | |
2110 | <member>0x0400 Purge the externid cache</member> | |
2111 | <member>0x0800 Purge the userdetails cache</member> | |
2112 | <member>0x1000 Purge the server cache</member> | |
2113 | </simplelist> | |
2114 | </para> | |
2096 | 2115 | </listitem> |
2097 | 2116 | </varlistentry> |
2098 | 2117 |
370 | 370 | \fB\-\-clear\-cache\fR |
371 | 371 | .RS 4 |
372 | 372 | Clears the server\*(Aqs caches\&. All data cached inside the zarafa\-server is cleared\&. Although this can never cause any data loss, it can affect the performance of your server, since any data requested after the cache is cleared needs to be re\-requested from the database or LDAP server\&. Normally this option is never needed; it is mostly used as a diagnostics tool\&. |
373 | .sp | |
374 | Optionally use | |
375 | \fI\-\-clear\-cache=\fR | |
376 | to specify a set of purge options\&. The following options can be used: | |
377 | .RS 4 | |
378 | 0x0000 Release no longer used memory back to the kernel | |
379 | .RE | |
380 | .RS 4 | |
381 | 0x0001 Purge the quota cache | |
382 | .RE | |
383 | .RS 4 | |
384 | 0x0002 Purge the quota default cache | |
385 | .RE | |
386 | .RS 4 | |
387 | 0x0004 Purge the object cache | |
388 | .RE | |
389 | .RS 4 | |
390 | 0x0008 Purge the store cache | |
391 | .RE | |
392 | .RS 4 | |
393 | 0x0010 Purge the ACL cache | |
394 | .RE | |
395 | .RS 4 | |
396 | 0x0020 Purge the cell cache | |
397 | .RE | |
398 | .RS 4 | |
399 | 0x0040 Purge the index1 cache | |
400 | .RE | |
401 | .RS 4 | |
402 | 0x0080 Purge the index2 cache | |
403 | .RE | |
404 | .RS 4 | |
405 | 0x0100 Purge the indexproperty cache | |
406 | .RE | |
407 | .RS 4 | |
408 | 0x0200 Purge the user object cache | |
409 | .RE | |
410 | .RS 4 | |
411 | 0x0400 Purge the externid cache | |
412 | .RE | |
413 | .RS 4 | |
414 | 0x0800 Purge the userdetails cache | |
415 | .RE | |
416 | .RS 4 | |
417 | 0x1000 Purge the server cache | |
418 | .RE | |
373 | 419 | .RE |
374 | 420 | .PP |
375 | 421 | \fB\-\-purge\-softdelete\fR \fIdays\fR |
285 | 285 | property_mv_map::iterator mvi; |
286 | 286 | std::list<std::string>::iterator istr; |
287 | 287 | |
288 | ulSize += sizeof(property_map::value_type) * m_mapProps.size(); | |
288 | ulSize += MEMORY_USAGE_MAP(m_mapProps.size(), property_map); | |
289 | 289 | for (i = m_mapProps.begin(); i != m_mapProps.end(); i++) |
290 | ulSize += i->second.size(); | |
291 | ||
292 | ulSize += sizeof(property_mv_map::value_type) * m_mapMVProps.size(); | |
290 | ulSize += MEMORY_USAGE_STRING(i->second); | |
291 | ||
292 | ulSize += MEMORY_USAGE_MAP(m_mapMVProps.size(), property_mv_map); | |
293 | 293 | |
294 | 294 | for (mvi = m_mapMVProps.begin(); mvi != m_mapMVProps.end(); mvi++) { |
295 | ulSize += mvi->second.size() * sizeof(std::string); | |
296 | 295 | for (istr = mvi->second.begin(); istr != mvi->second.end(); istr++) |
297 | ulSize += (*istr).size(); | |
296 | ulSize += MEMORY_USAGE_STRING((*istr)); | |
298 | 297 | } |
299 | 298 | |
300 | 299 | return ulSize; |
93 | 93 | return val.GetSize(); |
94 | 94 | } |
95 | 95 | |
96 | template<> | |
97 | unsigned int GetCacheAdditionalSize(const std::string &val) { | |
98 | return MEMORY_USAGE_STRING(val); | |
99 | } | |
100 | ||
101 | template<> | |
102 | unsigned int GetCacheAdditionalSize(const ECsUEIdKey &val) { | |
103 | return MEMORY_USAGE_STRING(val.strExternId); | |
104 | } | |
96 | 105 | |
97 | 106 | ECCacheManager::ECCacheManager(ECConfig *lpConfig, ECDatabaseFactory *lpDatabaseFactory, ECLogger *lpLogger) |
98 | 107 | : m_QuotaCache("quota", atoi(lpConfig->GetSetting("cache_quota_size")), atoi(lpConfig->GetSetting("cache_quota_lifetime")) * 60) |
3339 | 3339 | ulSize += SortOrderArraySize(lpsSortOrderArray); |
3340 | 3340 | ulSize += PropTagArraySize(lpsPropTagArray); |
3341 | 3341 | ulSize += RestrictTableSize(lpsRestrict); |
3342 | ulSize += m_listMVSortCols.size() * sizeof(ECListInt::value_type); | |
3343 | ||
3344 | ulSize += mapObjects.size() * sizeof(ECObjectTableMap::value_type); | |
3342 | ulSize += MEMORY_USAGE_LIST(m_listMVSortCols.size(), ECListInt); | |
3343 | ||
3344 | ulSize += MEMORY_USAGE_MAP(mapObjects.size(), ECObjectTableMap); | |
3345 | 3345 | ulSize += lpKeyTable->GetObjectSize(); |
3346 | 3346 | |
3347 | ulSize += m_mapCategories.size() * sizeof(ECCategoryMap::value_type); | |
3347 | ulSize += MEMORY_USAGE_MAP(m_mapCategories.size(), ECCategoryMap); | |
3348 | 3348 | for(iterCat = m_mapCategories.begin(); iterCat != m_mapCategories.end(); iterCat++) { |
3349 | 3349 | ulSize += iterCat->second->GetObjectSize(); |
3350 | 3350 | } |
3351 | 3351 | |
3352 | ulSize += m_mapLeafs.size() * sizeof(ECLeafMap::value_type); | |
3352 | ulSize += MEMORY_USAGE_MAP(m_mapLeafs.size(), ECLeafMap); | |
3353 | 3353 | |
3354 | 3354 | pthread_mutex_unlock(&m_hLock); |
3355 | 3355 |
1630 | 1630 | unsigned int ECSecurity::GetObjectSize() |
1631 | 1631 | { |
1632 | 1632 | unsigned int ulSize = sizeof(*this); |
1633 | unsigned int ulItems; | |
1633 | 1634 | |
1634 | 1635 | list<localobjectdetails_t>::iterator iter; |
1635 | 1636 | |
1636 | 1637 | ulSize += m_details.GetObjectSize(); |
1638 | ulSize += m_impersonatorDetails.GetObjectSize(); | |
1639 | ||
1637 | 1640 | |
1638 | 1641 | if (m_lpGroups) { |
1639 | for (iter = m_lpGroups->begin(); iter != m_lpGroups->end(); iter++) | |
1642 | for (iter = m_lpGroups->begin(), ulItems = 0; iter != m_lpGroups->end(); iter++, ulItems++) | |
1640 | 1643 | ulSize += iter->GetObjectSize(); |
1644 | ||
1645 | ulSize += MEMORY_USAGE_LIST(ulItems, list<localobjectdetails_t>); | |
1641 | 1646 | } |
1642 | 1647 | |
1643 | 1648 | if (m_lpViewCompanies) |
1644 | 1649 | { |
1645 | for (iter = m_lpViewCompanies->begin(); iter != m_lpViewCompanies->end(); iter++) | |
1650 | for (iter = m_lpViewCompanies->begin(), ulItems = 0; iter != m_lpViewCompanies->end(); iter++, ulItems++) | |
1646 | 1651 | ulSize += iter->GetObjectSize(); |
1652 | ||
1653 | ulSize += MEMORY_USAGE_LIST(ulItems, list<localobjectdetails_t>); | |
1647 | 1654 | } |
1648 | 1655 | |
1649 | 1656 | if (m_lpAdminCompanies) |
1650 | 1657 | { |
1651 | for (iter = m_lpAdminCompanies->begin(); iter != m_lpAdminCompanies->end(); iter++) | |
1658 | for (iter = m_lpAdminCompanies->begin(), ulItems = 0; iter != m_lpAdminCompanies->end(); iter++, ulItems++) | |
1652 | 1659 | ulSize += iter->GetObjectSize(); |
1660 | ||
1661 | ulSize += MEMORY_USAGE_LIST(ulItems, list<localobjectdetails_t>); | |
1653 | 1662 | } |
1654 | 1663 | |
1655 | 1664 | return ulSize; |
150 | 150 | m_lpUserManagement = NULL; |
151 | 151 | m_ulRequests = 0; |
152 | 152 | |
153 | m_ulLastRequestPort = 0; | |
154 | ||
153 | 155 | // Protects the object from deleting while a thread is running on a method in this object |
154 | 156 | pthread_cond_init(&m_hThreadReleased, NULL); |
155 | 157 | pthread_mutex_init(&m_hThreadReleasedMutex, NULL); |
271 | 273 | unsigned int BTSession::GetRequests() |
272 | 274 | { |
273 | 275 | return m_ulRequests; |
276 | } | |
277 | ||
278 | void BTSession::GetRequestURL(std::string *lpstrClientURL) | |
279 | { | |
280 | lpstrClientURL->assign(m_strLastRequestURL); | |
281 | } | |
282 | ||
283 | void BTSession::GetProxyHost(std::string *lpstrProxyHost) | |
284 | { | |
285 | lpstrProxyHost->assign(m_strProxyHost); | |
286 | } | |
287 | ||
288 | void BTSession::GetClientPort(unsigned int *lpulPort) | |
289 | { | |
290 | *lpulPort = m_ulLastRequestPort; | |
291 | } | |
292 | ||
293 | size_t BTSession::GetInternalObjectSize() | |
294 | { | |
295 | return MEMORY_USAGE_STRING(m_strSourceAddr) + | |
296 | MEMORY_USAGE_STRING(m_strLastRequestURL) + | |
297 | MEMORY_USAGE_STRING(m_strProxyHost); | |
274 | 298 | } |
275 | 299 | |
276 | 300 | ////////////////////////////////////////////////////////////////////// |
621 | 645 | lpstrClientApp->assign(m_strClientApp); |
622 | 646 | } |
623 | 647 | |
624 | void ECSession::GetRequestURL(std::string *lpstrClientURL) | |
625 | { | |
626 | lpstrClientURL->assign(m_strLastRequestURL); | |
627 | } | |
628 | ||
629 | void ECSession::GetProxyHost(std::string *lpstrProxyHost) | |
630 | { | |
631 | lpstrProxyHost->assign(m_strProxyHost); | |
632 | } | |
633 | ||
634 | void ECSession::GetClientPort(unsigned int *lpulPort) | |
635 | { | |
636 | *lpulPort = m_ulLastRequestPort; | |
637 | } | |
638 | 648 | |
639 | 649 | /** |
640 | 650 | * Get the object id of the object specified by the provided entryid. |
703 | 713 | |
704 | 714 | exit: |
705 | 715 | return er; |
716 | } | |
717 | ||
718 | size_t ECSession::GetObjectSize() | |
719 | { | |
720 | size_t ulSize = sizeof(*this); | |
721 | ||
722 | ulSize += GetInternalObjectSize(); | |
723 | ulSize += MEMORY_USAGE_STRING(m_strClientApp) + | |
724 | MEMORY_USAGE_STRING(m_strUsername) + | |
725 | MEMORY_USAGE_STRING(m_strClientVersion); | |
726 | ||
727 | ulSize += MEMORY_USAGE_MAP(m_mapBusyStates.size(), BusyStateMap); | |
728 | ulSize += MEMORY_USAGE_MAP(m_mapLocks.size(), LockMap); | |
729 | ||
730 | if (m_lpEcSecurity) | |
731 | ulSize += m_lpEcSecurity->GetObjectSize(); | |
732 | ||
733 | ||
734 | // The Table manager size is not callculated here | |
735 | // ulSize += GetTableManager()->GetObjectSize(); | |
736 | ||
737 | return ulSize; | |
706 | 738 | } |
707 | 739 | |
708 | 740 | |
1449 | 1481 | return er; |
1450 | 1482 | } |
1451 | 1483 | |
1484 | size_t ECAuthSession::GetObjectSize() | |
1485 | { | |
1486 | size_t ulSize = sizeof(*this); | |
1487 | ||
1488 | return ulSize; | |
1489 | } | |
1490 | ||
1452 | 1491 | |
1453 | 1492 | ECAuthSessionOffline::ECAuthSessionOffline(const std::string &strSourceAddr, ECSESSIONID sessionID, ECDatabaseFactory *lpDatabaseFactory, ECSessionManager *lpSessionManager, unsigned int ulCapabilities) : |
1454 | 1493 | ECAuthSession(strSourceAddr, sessionID, lpDatabaseFactory, lpSessionManager, ulCapabilities) |
122 | 122 | virtual void RecordRequest(struct soap *soap); |
123 | 123 | virtual unsigned int GetRequests(); |
124 | 124 | |
125 | virtual void GetClientPort(unsigned int *lpulPort); | |
126 | virtual void GetRequestURL(std::string *lpstrURL); | |
127 | virtual void GetProxyHost(std::string *lpstrProxyHost); | |
128 | ||
129 | size_t GetInternalObjectSize(); | |
130 | virtual size_t GetObjectSize() = 0; | |
131 | ||
125 | 132 | time_t GetIdleTime(); |
126 | 133 | std::string GetSourceAddr(); |
127 | 134 | |
193 | 200 | void GetClocks(double *lpdblUser, double *lpdblSystem, double *lpdblReal); |
194 | 201 | void GetClientVersion(std::string *lpstrVersion); |
195 | 202 | void GetClientApp(std::string *lpstrClientApp); |
196 | void GetClientPort(unsigned int *lpulPort); | |
197 | void GetRequestURL(std::string *lpstrURL); | |
198 | void GetProxyHost(std::string *lpstrProxyHost); | |
203 | ||
204 | size_t GetObjectSize(); | |
199 | 205 | |
200 | 206 | unsigned int ClientVersion() const { return m_ulClientVersion; } |
201 | 207 | |
207 | 213 | ECSecurity *m_lpEcSecurity; |
208 | 214 | |
209 | 215 | pthread_mutex_t m_hStateLock; |
210 | std::map<pthread_t, BUSYSTATE> m_mapBusyStates; /* which thread does what function */ | |
216 | typedef std::map<pthread_t, BUSYSTATE> BusyStateMap; | |
217 | BusyStateMap m_mapBusyStates; /* which thread does what function */ | |
211 | 218 | double m_dblUser; |
212 | 219 | double m_dblSystem; |
213 | 220 | double m_dblReal; |
240 | 247 | |
241 | 248 | virtual ECRESULT CreateECSession(ECSESSIONGROUPID ecSessionGroupId, std::string strClientVersion, std::string strClientApp, ECSESSIONID *sessionID, ECSession **lppNewSession); |
242 | 249 | |
250 | size_t GetObjectSize(); | |
251 | ||
243 | 252 | protected: |
244 | 253 | unsigned int m_ulUserID; |
245 | 254 | unsigned int m_ulImpersonatorID; // The ID of the user who's credentials were used to login when using impersonation |
583 | 583 | { |
584 | 584 | NOTIFICATIONLIST::iterator iterlNotify; |
585 | 585 | unsigned int ulSize = 0; |
586 | ||
587 | pthread_mutex_lock(&m_hNotificationLock); | |
588 | ||
589 | ulSize += m_listNotification.size() * sizeof(NOTIFICATIONLIST::value_type); | |
590 | ulSize += m_mapSubscribe.size() * sizeof(SUBSCRIBEMAP::value_type); | |
591 | ulSize += m_mapChangeSubscribe.size() * sizeof(CHANGESUBSCRIBEMAP::value_type); | |
592 | ||
593 | for(iterlNotify = m_listNotification.begin(); iterlNotify != m_listNotification.end(); iterlNotify++) | |
586 | unsigned int ulItems; | |
587 | ||
588 | pthread_mutex_lock(&m_hNotificationLock); | |
589 | ||
590 | ulSize += MEMORY_USAGE_MAP(m_mapSubscribe.size(), SUBSCRIBEMAP); | |
591 | ulSize += MEMORY_USAGE_MAP(m_mapChangeSubscribe.size(), CHANGESUBSCRIBEMAP); | |
592 | ||
593 | for(iterlNotify = m_listNotification.begin(), ulItems = 0; iterlNotify != m_listNotification.end(); iterlNotify++, ulItems++) | |
594 | 594 | { |
595 | 595 | ulSize += iterlNotify->GetObjectSize(); |
596 | 596 | } |
597 | ulSize += MEMORY_USAGE_LIST(ulItems, NOTIFICATIONLIST); | |
597 | 598 | |
598 | 599 | pthread_mutex_unlock(&m_hNotificationLock); |
599 | 600 | |
600 | 601 | ulSize += sizeof(*this); |
601 | 602 | |
602 | 603 | pthread_mutex_lock(&m_hSessionMapLock); |
603 | ulSize += m_mapSessions.size() * sizeof(SESSIONINFOMAP::value_type); | |
604 | ulSize += MEMORY_USAGE_MAP(m_mapSessions.size(), SESSIONINFOMAP); | |
604 | 605 | pthread_mutex_unlock(&m_hSessionMapLock); |
605 | 606 | |
606 | 607 | pthread_mutex_lock(&m_mutexSubscribedStores); |
607 | ulSize += m_mapSubscribedStores.size() * sizeof(unsigned int); | |
608 | ulSize += MEMORY_USAGE_MULTIMAP(m_mapSubscribedStores.size(), SUBSCRIBESTOREMULTIMAP); | |
608 | 609 | pthread_mutex_unlock(&m_mutexSubscribedStores); |
609 | 610 | |
610 | 611 | return ulSize; |
82 | 82 | |
83 | 83 | typedef std::list<ECNotification> NOTIFICATIONLIST; |
84 | 84 | typedef std::map<unsigned int, subscribeItem> SUBSCRIBEMAP; |
85 | typedef std::multimap<unsigned int, unsigned int> SUBSCRIBESTOREMULTIMAP; | |
85 | 86 | |
86 | 87 | struct changeSubscribeItem { |
87 | 88 | ECSESSIONID ulSession; |
181 | 182 | ECSessionManager * m_lpSessionManager; |
182 | 183 | |
183 | 184 | /* Multimap of subscriptions that we have (key -> store id) */ |
184 | std::multimap<unsigned int, unsigned int> m_mapSubscribedStores; | |
185 | SUBSCRIBESTOREMULTIMAP m_mapSubscribedStores; | |
185 | 186 | pthread_mutex_t m_mutexSubscribedStores; |
186 | 187 | |
187 | 188 | private: |
1412 | 1412 | pthread_rwlock_rdlock(&m_hCacheRWLock); |
1413 | 1413 | |
1414 | 1414 | sStats.session.ulItems = m_mapSessions.size(); |
1415 | sStats.session.ullSize = sStats.session.ulItems * sizeof(SESSIONMAP::value_type); | |
1415 | sStats.session.ullSize = MEMORY_USAGE_MAP(sStats.session.ulItems, SESSIONMAP); | |
1416 | 1416 | |
1417 | 1417 | // lock and copy sessions so we can release the main sessionmanager lock before we call the tablemanager to avoid other locks |
1418 | 1418 | |
1435 | 1435 | lpSess = *i; |
1436 | 1436 | lpSess->GetTableManager()->GetStats(&ulTmpTables, &ulTmpTableSize); |
1437 | 1437 | |
1438 | sStats.session.ullSize += lpSess->GetSecurity()->GetObjectSize(); | |
1438 | sStats.session.ullSize += lpSess->GetObjectSize(); | |
1439 | 1439 | sStats.session.ulOpenTables += ulTmpTables; |
1440 | 1440 | sStats.session.ulTableSize += ulTmpTableSize; |
1441 | 1441 | |
1446 | 1446 | pthread_rwlock_rdlock(&m_hGroupLock); |
1447 | 1447 | |
1448 | 1448 | sStats.group.ulItems = m_mapSessionGroups.size(); |
1449 | sStats.group.ullSize = sStats.group.ulItems * sizeof(SESSIONGROUPMAP::value_type); | |
1449 | sStats.group.ullSize = MEMORY_USAGE_HASHMAP(sStats.group.ulItems, SESSIONGROUPMAP); | |
1450 | 1450 | |
1451 | 1451 | for (itersg = m_mapSessionGroups.begin(); itersg != m_mapSessionGroups.end(); itersg++) { |
1452 | 1452 | sStats.group.ullSize += itersg->second->GetObjectSize(); |
1458 | 1458 | pthread_mutex_lock(&m_mutexPersistent); |
1459 | 1459 | |
1460 | 1460 | sStats.ulPersistentByConnection = m_mapPersistentByConnection.size(); |
1461 | sStats.ulPersistentByConnectionSize = sStats.ulPersistentByConnection * sizeof(PERSISTENTBYCONNECTION::value_type); | |
1461 | sStats.ulPersistentByConnectionSize = MEMORY_USAGE_HASHMAP(sStats.ulPersistentByConnection, PERSISTENTBYCONNECTION); | |
1462 | 1462 | |
1463 | 1463 | sStats.ulPersistentBySession = m_mapPersistentBySession.size(); |
1464 | sStats.ulPersistentBySessionSize = sStats.ulPersistentBySession * sizeof(PERSISTENTBYSESSION::value_type); | |
1464 | sStats.ulPersistentBySessionSize = MEMORY_USAGE_HASHMAP(sStats.ulPersistentBySession, PERSISTENTBYSESSION); | |
1465 | 1465 | |
1466 | 1466 | pthread_mutex_unlock(&m_mutexPersistent); |
1467 | 1467 | |
1469 | 1469 | pthread_mutex_lock(&m_mutexTableSubscriptions); |
1470 | 1470 | |
1471 | 1471 | sStats.ulTableSubscriptions = m_mapTableSubscriptions.size(); |
1472 | sStats.ulTableSubscriptionSize = sStats.ulTableSubscriptions * sizeof(TABLESUBSCRIPTIONMULTIMAP::value_type); | |
1472 | sStats.ulTableSubscriptionSize = MEMORY_USAGE_MULTIMAP(sStats.ulTableSubscriptions, TABLESUBSCRIPTIONMULTIMAP); | |
1473 | 1473 | |
1474 | 1474 | pthread_mutex_unlock(&m_mutexTableSubscriptions); |
1475 | 1475 | |
1477 | 1477 | pthread_mutex_lock(&m_mutexObjectSubscriptions); |
1478 | 1478 | |
1479 | 1479 | sStats.ulObjectSubscriptions = m_mapObjectSubscriptions.size(); |
1480 | sStats.ulObjectSubscriptionSize = sStats.ulObjectSubscriptions * sizeof(OBJECTSUBSCRIPTIONSMULTIMAP::value_type); | |
1480 | sStats.ulObjectSubscriptionSize = MEMORY_USAGE_MULTIMAP(sStats.ulObjectSubscriptions, OBJECTSUBSCRIPTIONSMULTIMAP); | |
1481 | 1481 | |
1482 | 1482 | pthread_mutex_unlock(&m_mutexObjectSubscriptions); |
1483 | 1483 |
65 | 65 | |
66 | 66 | #include "ECStatsCollector.h" |
67 | 67 | |
68 | #ifdef HAVE_TCMALLOC | |
69 | #include "google/malloc_extension.h" | |
70 | #endif | |
71 | ||
72 | ||
68 | 73 | // Link to provider/server |
69 | 74 | void zarafa_get_server_stats(unsigned int *lpulQueueLen, double *lpDblQueueAge, unsigned int *lpulThreads, unsigned int *lpulIdleThreads); |
70 | 75 | |
130 | 135 | //lpSession->GetSessionManager()->GetLicensedUsers(1/*SERVICE_TYPE_ARCHIVE*/, &ulLicensedArchivedUsers); |
131 | 136 | //GetStatsCollectorData("??????????", "Number of allowed archive users", stringify(ulLicensedArchivedUsers), this); |
132 | 137 | |
138 | #ifdef HAVE_TCMALLOC | |
139 | size_t value = 0; | |
140 | MallocExtension::instance()->GetNumericProperty("generic.current_allocated_bytes", &value); | |
141 | GetStatsCollectorData("tc_allocated", "Current allocated memory by TCMalloc", stringify_int64(value), this); // Bytes in use by application | |
142 | ||
143 | value = 0; | |
144 | MallocExtension::instance()->GetNumericProperty("generic.heap_size", &value); | |
145 | GetStatsCollectorData("tc_reserved", "Bytes of system memory reserved by TCMalloc", stringify_int64(value), this); | |
146 | ||
147 | value = 0; | |
148 | MallocExtension::instance()->GetNumericProperty("tcmalloc.pageheap_free_bytes", &value); | |
149 | GetStatsCollectorData("tc_page_map_free", "Number of bytes in free, mapped pages in page heap", stringify_int64(value), this); | |
150 | ||
151 | value = 0; | |
152 | MallocExtension::instance()->GetNumericProperty("tcmalloc.pageheap_unmapped_bytes", &value); | |
153 | GetStatsCollectorData("tc_page_unmap_free", "Number of bytes in free, unmapped pages in page heap (released to OS)", stringify_int64(value), this); | |
154 | ||
155 | value = 0; | |
156 | MallocExtension::instance()->GetNumericProperty("tcmalloc.max_total_thread_cache_bytes", &value); | |
157 | GetStatsCollectorData("tc_threadcache_max", "A limit to how much memory TCMalloc dedicates for small objects", stringify_int64(value), this); | |
158 | ||
159 | value = 0; | |
160 | MallocExtension::instance()->GetNumericProperty("tcmalloc.current_total_thread_cache_bytes", &value); | |
161 | GetStatsCollectorData("tc_threadcache_cur", "Current allocated memory in bytes for thread cache", stringify_int64(value), this); | |
162 | ||
163 | #ifdef DEBUG | |
164 | char test[2048] = {0}; | |
165 | MallocExtension::instance()->GetStats(test, sizeof(test)); | |
166 | GetStatsCollectorData("tc_stats_string", "TCMalloc memory debug data", test, this); | |
167 | #endif | |
168 | ||
169 | #endif | |
133 | 170 | |
134 | 171 | // add all items to the keytable |
135 | 172 | for (i = 0; i < id; i++) { |
763 | 763 | pthread_mutex_lock(&hListMutex); |
764 | 764 | |
765 | 765 | ulTables = mapTable.size(); |
766 | ulSize = ulTables * (sizeof(TABLEENTRYMAP::value_type) + sizeof(TABLE_ENTRY)); | |
766 | ulSize = MEMORY_USAGE_MAP(ulTables, TABLEENTRYMAP); | |
767 | 767 | |
768 | 768 | for(iterEntry = mapTable.begin(); iterEntry != mapTable.end(); iterEntry++) { |
769 | 769 | if(iterEntry->second->ulTableType != TABLE_ENTRY::TABLE_TYPE_SYSTEMSTATS) // Skip system stats since it would recursively include itself |
113 | 113 | |
114 | 114 | #include "ZarafaCmdUtil.h" |
115 | 115 | #include "ECThreadPool.h" |
116 | ||
117 | #ifdef HAVE_TCMALLOC | |
118 | #include "google/malloc_extension.h" | |
119 | #endif | |
116 | 120 | |
117 | 121 | #define STRIN_FIX(s) (bSupportUnicode ? (s) : ECStringCompat::WTF1252_to_UTF8(soap, (s))) |
118 | 122 | #define STROUT_FIX(s) (bSupportUnicode ? (s) : ECStringCompat::UTF8_to_WTF1252(soap, (s))) |
5846 | 5850 | |
5847 | 5851 | er = g_lpSessionManager->GetCacheManager()->PurgeCache(ulFlags); |
5848 | 5852 | |
5853 | #ifdef HAVE_TCMALLOC | |
5854 | MallocExtension::instance()->ReleaseFreeMemory(); | |
5855 | #endif | |
5856 | ||
5849 | 5857 | g_lpStatsCollector->SetTime(SCN_SERVER_LAST_CACHECLEARED, time(NULL)); |
5850 | 5858 | exit: |
5851 | 5859 | ; |