[asterisk-commits] rmudgett: trunk r398583 - in /trunk: ./ main/cdr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 6 16:17:46 CDT 2013


Author: rmudgett
Date: Fri Sep  6 16:17:45 2013
New Revision: 398583

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398583
Log:
cdr: Change the number of container buckets to be similar to the channels container.

* Fix the temporary cdr candidate containers to use a prime number of
buckets.
........

Merged revisions 398579 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/cdr.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Fri Sep  6 16:17:45 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398198,398206,398215,398226,398237,398283,398286,398299,398303,398368,398381,398418,398458,398498,398511,398521,398533,398562,398572
+/branches/12:1-398198,398206,398215,398226,398237,398283,398286,398299,398303,398368,398381,398418,398458,398498,398511,398521,398533,398562,398572,398579

Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=398583&r1=398582&r2=398583
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Fri Sep  6 16:17:45 2013
@@ -192,6 +192,13 @@
  ***/
 
 
+/* The prime here should be similar in size to the channel container. */
+#ifdef LOW_MEMORY
+#define NUM_CDR_BUCKETS 61
+#else
+#define NUM_CDR_BUCKETS 769
+#endif
+
 #define DEFAULT_ENABLED "1"
 #define DEFAULT_BATCHMODE "0"
 #define DEFAULT_UNANSWERED "0"
@@ -2279,7 +2286,7 @@
  */
 static struct ao2_container *create_candidates_for_bridge(struct ast_bridge_snapshot *bridge)
 {
-	struct ao2_container *candidates = ao2_container_alloc(51, bridge_candidate_hash_fn, bridge_candidate_cmp_fn);
+	struct ao2_container *candidates = ao2_container_alloc(61, bridge_candidate_hash_fn, bridge_candidate_cmp_fn);
 	char *bridge_id = ast_strdupa(bridge->uniqueid);
 	struct ao2_iterator *it_cdrs;
 	struct cdr_object *cand_cdr_master;
@@ -2429,11 +2436,7 @@
 	if (!candidates) {
 		return;
 	}
-	ao2_callback(candidates, OBJ_NODATA,
-			bridge_candidate_process,
-			cdr);
-
-	return;
+	ao2_callback(candidates, OBJ_NODATA, bridge_candidate_process, cdr);
 }
 
 /*! \brief Handle entering into a parking bridge
@@ -4029,7 +4032,6 @@
 	}
 }
 
-
 int ast_cdr_engine_init(void)
 {
 	RAII_VAR(struct module_config *, mod_cfg, NULL, ao2_cleanup);
@@ -4038,8 +4040,8 @@
 		return -1;
 	}
 
-	/* The prime here should be the same as the channel container */
-	active_cdrs_by_channel = ao2_container_alloc(51, cdr_object_channel_hash_fn, cdr_object_channel_cmp_fn);
+	active_cdrs_by_channel = ao2_container_alloc(NUM_CDR_BUCKETS,
+		cdr_object_channel_hash_fn, cdr_object_channel_cmp_fn);
 	if (!active_cdrs_by_channel) {
 		return -1;
 	}




More information about the asterisk-commits mailing list