[svn-commits] mmichelson: branch group/performance r400018 - in /team/group/performance: ch...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Sep 27 16:54:57 CDT 2013


Author: mmichelson
Date: Fri Sep 27 16:54:54 2013
New Revision: 400018

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400018
Log:
Remove unnecessary waits from stasis.

Since caches are updated on publisher threads, there is no need
to wait for the cache updates to occur after a stasis message
is published.

In the case of chan_pjsip device state changes, this set of
changes caused an improvement to performance.


Removed:
    team/group/performance/main/stasis_wait.c
Modified:
    team/group/performance/channels/chan_pjsip.c
    team/group/performance/include/asterisk/stasis.h
    team/group/performance/include/asterisk/stasis_endpoints.h
    team/group/performance/main/stasis.c
    team/group/performance/main/stasis_endpoints.c
    team/group/performance/res/ari/resource_endpoints.c
    team/group/performance/tests/test_cel.c

Modified: team/group/performance/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/channels/chan_pjsip.c?view=diff&rev=400018&r1=400017&r2=400018
==============================================================================
--- team/group/performance/channels/chan_pjsip.c (original)
+++ team/group/performance/channels/chan_pjsip.c Fri Sep 27 16:54:54 2013
@@ -896,7 +896,11 @@
 	}
 
 	endpoint_snapshot = ast_endpoint_latest_snapshot(ast_endpoint_get_tech(endpoint->persistent),
-		ast_endpoint_get_resource(endpoint->persistent), 1);
+		ast_endpoint_get_resource(endpoint->persistent));
+
+	if (!endpoint_snapshot) {
+		return AST_DEVICE_INVALID;
+	}
 
 	if (endpoint_snapshot->state == AST_ENDPOINT_OFFLINE) {
 		state = AST_DEVICE_UNAVAILABLE;
@@ -916,7 +920,6 @@
 		RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 		struct ast_channel_snapshot *snapshot;
 
-		stasis_topic_wait(ast_channel_topic_all_cached());
 		msg = stasis_cache_get(cache, ast_channel_snapshot_type(),
 			endpoint_snapshot->channel_ids[num]);
 

Modified: team/group/performance/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/include/asterisk/stasis.h?view=diff&rev=400018&r1=400017&r2=400018
==============================================================================
--- team/group/performance/include/asterisk/stasis.h (original)
+++ team/group/performance/include/asterisk/stasis.h Fri Sep 27 16:54:54 2013
@@ -347,15 +347,6 @@
  */
 void stasis_publish(struct stasis_topic *topic, struct stasis_message *message);
 
-/*!
- * \brief Wait for all pending messages on a given topic to be processed.
- * \param topic Topic to await pending messages on.
- * \return 0 on success.
- * \return Non-zero on error.
- * \since 12
- */
-int stasis_topic_wait(struct stasis_topic *topic);
-
 /*! @} */
 
 /*! @{ */
@@ -868,11 +859,6 @@
  */
 int stasis_config_init(void);
 
-/*!
- * \internal
- */
-int stasis_wait_init(void);
-
 /*! @} */
 
 /*!

Modified: team/group/performance/include/asterisk/stasis_endpoints.h
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/include/asterisk/stasis_endpoints.h?view=diff&rev=400018&r1=400017&r2=400018
==============================================================================
--- team/group/performance/include/asterisk/stasis_endpoints.h (original)
+++ team/group/performance/include/asterisk/stasis_endpoints.h Fri Sep 27 16:54:54 2013
@@ -194,14 +194,12 @@
  *
  * \param tech Name of the endpoint's technology.
  * \param resource Resource name of the endpoint.
- * \param guaranteed Whether to require all pending messages to have been processed or not.
  * \return Snapshot of the endpoint with the given name.
  * \return \c NULL if endpoint is not found, or on error.
  * \since 12
  */
 struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *tech,
-	const char *resource,
-	unsigned int guaranteed
+	const char *resource
 );
 
 /*! @} */

Modified: team/group/performance/main/stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/main/stasis.c?view=diff&rev=400018&r1=400017&r2=400018
==============================================================================
--- team/group/performance/main/stasis.c (original)
+++ team/group/performance/main/stasis.c Fri Sep 27 16:54:54 2013
@@ -803,11 +803,6 @@
 	/* Be sure the types are cleaned up after the message bus */
 	ast_register_cleanup(stasis_cleanup);
 
-	if (stasis_wait_init() != 0) {
-		ast_log(LOG_ERROR, "Stasis initialization failed\n");
-		return -1;
-	}
-
 	cache_init = stasis_cache_init();
 	if (cache_init != 0) {
 		return -1;

Modified: team/group/performance/main/stasis_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/main/stasis_endpoints.c?view=diff&rev=400018&r1=400017&r2=400018
==============================================================================
--- team/group/performance/main/stasis_endpoints.c (original)
+++ team/group/performance/main/stasis_endpoints.c Fri Sep 27 16:54:54 2013
@@ -187,7 +187,7 @@
 }
 
 struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *tech,
-	const char *name, unsigned int guaranteed)
+	const char *name)
 {
 	RAII_VAR(char *, id, NULL, ast_free);
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
@@ -196,10 +196,6 @@
 	ast_asprintf(&id, "%s/%s", tech, name);
 	if (!id) {
 		return NULL;
-	}
-
-	if (guaranteed) {
-		stasis_topic_wait(ast_endpoint_topic_all_cached());
 	}
 
 	msg = stasis_cache_get(ast_endpoint_cache(),

Modified: team/group/performance/res/ari/resource_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/res/ari/resource_endpoints.c?view=diff&rev=400018&r1=400017&r2=400018
==============================================================================
--- team/group/performance/res/ari/resource_endpoints.c (original)
+++ team/group/performance/res/ari/resource_endpoints.c Fri Sep 27 16:54:54 2013
@@ -140,7 +140,7 @@
 	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
 	RAII_VAR(struct ast_endpoint_snapshot *, snapshot, NULL, ao2_cleanup);
 
-	snapshot = ast_endpoint_latest_snapshot(args->tech, args->resource, 0);
+	snapshot = ast_endpoint_latest_snapshot(args->tech, args->resource);
 	if (!snapshot) {
 		ast_ari_response_error(response, 404, "Not Found",
 			"Endpoint not found");

Modified: team/group/performance/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/tests/test_cel.c?view=diff&rev=400018&r1=400017&r2=400018
==============================================================================
--- team/group/performance/tests/test_cel.c (original)
+++ team/group/performance/tests/test_cel.c Fri Sep 27 16:54:54 2013
@@ -254,7 +254,6 @@
 	ast_hangup((channel)); \
 	HANGUP_EVENT(channel, cause, dialstatus); \
 	APPEND_EVENT(channel, AST_CEL_CHANNEL_END, NULL, NULL); \
-	stasis_topic_wait(ast_channel_topic_all_cached()); \
 	ao2_cleanup(stasis_cache_get(ast_channel_cache(), \
 		ast_channel_snapshot_type(), ast_channel_uniqueid(channel))); \
 	ao2_cleanup(channel); \




More information about the svn-commits mailing list