Skip to content

Commit

Permalink
Merge branch 'scib_rate_prec_sign_fix_34' into 'OVIS-3.4'
Browse files Browse the repository at this point in the history
sysclassib rate computation across resets (3.4)

This fixes the conversions and precision so rates are computed "correctly" across counter resets.
Users can now filter rate data based on sign to detect counter resets where they could not before.

See merge request !999
  • Loading branch information
narategithub committed Jul 12, 2018
2 parents e74f77b + 1a2f105 commit b018ee2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ldms/src/sampler/sysclassib.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static int create_metric_set(const char *instance_name, char *schema_name)
port->ca,
port->portno);
port->rate[i] = ldms_schema_metric_add(schema, metric_name,
LDMS_V_F32);
LDMS_V_D64);
}
}
}
Expand Down Expand Up @@ -641,21 +641,21 @@ static ldms_set_t get_set(struct ldmsd_sampler *self)
*/
static
inline void update_metric(struct scib_port *port, int idx, uint64_t new_v,
float dt)
double dt)
{
uint64_t old_v = ldms_metric_get_u64(set, port->handle[idx]);
if (!port->ext)
new_v += old_v;
ldms_metric_set_u64(set, port->handle[idx], new_v);
if (sysclassib_metrics_type == SYSCLASSIB_METRICS_BOTH) {
ldms_metric_set_float(set, port->rate[idx], (new_v - old_v) / dt);
ldms_metric_set_double(set, port->rate[idx], ((double)new_v - (double)old_v) / dt);
}
}

/**
* Port query (utility function).
*/
int query_port(struct scib_port *port, float dt)
int query_port(struct scib_port *port, double dt)
{
void *p;
int rc;
Expand Down Expand Up @@ -733,7 +733,7 @@ static int sample(struct ldmsd_sampler *self)
{
struct timeval *tmp;
struct timeval tv_diff;
float dt;
double dt;
struct scib_port *port;

if (!set) {
Expand All @@ -743,7 +743,7 @@ static int sample(struct ldmsd_sampler *self)

gettimeofday(tv_now, 0);
timersub(tv_now, tv_prev, &tv_diff);
dt = tv_diff.tv_sec + tv_diff.tv_usec / 1e06f;
dt = (double)tv_diff.tv_sec + tv_diff.tv_usec / 1.0e06;

ldms_transaction_begin(set);
LJI_SAMPLE(set,1);
Expand Down

0 comments on commit b018ee2

Please sign in to comment.