[PATCH 6/6] [mama] Negative Stats support


Ian Bell <IBell@...>
 

From fdd24468d25d4796bf59dc519b8f967ceeac78d3 Mon Sep 17 00:00:00 2001

Message-Id: <fdd24468d25d4796bf59dc519b8f967ceeac78d3.1348674366.git.ibell@...>

In-Reply-To: <ec11f834aa5ee941affd12c0baa32480c39efabd.1348674366.git.ibell@...>

References: <ec11f834aa5ee941affd12c0baa32480c39efabd.1348674366.git.ibell@...>

From: Ian Bell <ibell@...>

Date: Wed, 26 Sep 2012 16:44:03 +0100

Subject: [PATCH 6/6] [mama] Negative Stats support

 

Added ability ot handle negative interval stats

 

Signed-off-by: Ian Bell <ibell@...>

---

mama/c_cpp/src/c/mama/stat.h      |    2 +-

mama/c_cpp/src/c/stat.c           |    5 +++--

mama/c_cpp/src/c/statscollector.c |    6 +++---

3 files changed, 7 insertions(+), 6 deletions(-)

 

diff --git a/mama/c_cpp/src/c/mama/stat.h b/mama/c_cpp/src/c/mama/stat.h

index 5b94bb5..8ada0c8 100644

--- a/mama/c_cpp/src/c/mama/stat.h

+++ b/mama/c_cpp/src/c/mama/stat.h

@@ -197,7 +197,7 @@ mamaStat_getTotalValue (mamaStat stat);

  */

MAMAExpDLL

extern void

-mamaStat_getStats (mamaStat stat, mama_u32_t* intervalValue, mama_u32_t* maxValue, mama_u32_t* totalValue);

+mamaStat_getStats (mamaStat stat, mama_i32_t* intervalValue, mama_u32_t* maxValue, mama_u32_t* totalValue);

 /**

  * Get the name of the stat

diff --git a/mama/c_cpp/src/c/stat.c b/mama/c_cpp/src/c/stat.c

index 245917f..416a458 100644

--- a/mama/c_cpp/src/c/stat.c

+++ b/mama/c_cpp/src/c/stat.c

@@ -34,7 +34,7 @@ typedef struct mamaStatImpl__

     const char*         mName;

     mama_fid_t          mFid;

     mamaStatsCollector  mStatsCollector;

-    mama_u32_t          mIntervalValue;

+    mama_i32_t          mIntervalValue;

     mama_u32_t          mMaxValue;

     mama_u32_t          mTotalValue;

     int                 mLockable;

@@ -125,6 +125,7 @@ mamaStat_decrement (mamaStat stat)

     }

     impl->mIntervalValue--;

+    impl->mTotalValue--;

     if (impl->mLockable)

     {

@@ -298,7 +299,7 @@ mamaStat_getTotalValue (mamaStat stat)

}

 void

-mamaStat_getStats (mamaStat stat, mama_u32_t* intervalValue, mama_u32_t* maxValue, mama_u32_t* totalValue)

+mamaStat_getStats (mamaStat stat, mama_i32_t* intervalValue, mama_u32_t* maxValue, mama_u32_t* totalValue)

{

     mamaStatImpl* impl = (mamaStatImpl*)stat;

diff --git a/mama/c_cpp/src/c/statscollector.c b/mama/c_cpp/src/c/statscollector.c

index 83ddff5..3c3147f 100644

--- a/mama/c_cpp/src/c/statscollector.c

+++ b/mama/c_cpp/src/c/statscollector.c

@@ -115,7 +115,7 @@ mamaStatsCollector_populateMsg /*And string logging */ (mamaStatsCollector stats

     mama_fid_t  fid;

     const char* name = NULL;

     const char* type = NULL;

-    mama_u32_t  intervalValue = 0;

+    mama_i32_t  intervalValue = 0;

     mama_u32_t  maxValue      = 0;

     mama_u32_t  totalValue    = 0;

     int i;

@@ -150,7 +150,7 @@ mamaStatsCollector_populateMsg /*And string logging */ (mamaStatsCollector stats

                 name  = mamaStat_getName (impl->mMamaStats[i]);

                 mamaStat_getStats (impl->mMamaStats[i], &intervalValue, &maxValue, &totalValue);

-                mamaMsg_addU32 (msg, name, fid, intervalValue);

+                mamaMsg_addI32 (msg, name, fid, intervalValue);

             }

             if (impl->mLogStats && mamaStat_getLog (impl->mMamaStats[i]))

@@ -159,7 +159,7 @@ mamaStatsCollector_populateMsg /*And string logging */ (mamaStatsCollector stats

                 {

                     /* Stats are logged at WARN so that users don't have to enable NORMAL (or higher)

                        logging, even though they aren't actually warnings...*/

-                       mama_log (MAMA_LOG_LEVEL_WARN, "%24.24s | %9.9s | %10.10s | %15.15s | %10u | %10u | %10u |",

+                       mama_log (MAMA_LOG_LEVEL_WARN, "%24.24s | %9.9s | %10.10s | %15.15s | %10i | %10u | %10u |",

                                                       logHeader ? impl->mName : "",

                                                       logHeader ? type : "",

                                                       logHeader ? impl->mMiddleware : "",

--

1.7.9.5

 




Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.