@@ -91,10 +91,10 @@ static bool ksmodel_histo_alloc(struct kshark_trace_histo *histo, size_t n)
}
static void ksmodel_set_in_range_bining(struct kshark_trace_histo *histo,
- size_t n, uint64_t min, uint64_t max,
+ size_t n, int64_t min, int64_t max,
bool force_in_range)
{
- uint64_t corrected_range, delta_range, range = max - min;
+ int64_t corrected_range, delta_range, range = max - min;
struct kshark_entry *last;
/* The size of the bin must be >= 1, hence the range must be >= n. */
@@ -163,7 +163,7 @@ static void ksmodel_set_in_range_bining(struct kshark_trace_histo *histo,
* @param max: Upper edge of the time-window to be visualized.
*/
void ksmodel_set_bining(struct kshark_trace_histo *histo,
- size_t n, uint64_t min, uint64_t max)
+ size_t n, int64_t min, int64_t max)
{
ksmodel_set_in_range_bining(histo, n, min, max, false);
}
@@ -256,7 +256,7 @@ static size_t ksmodel_set_upper_edge(struct kshark_trace_histo *histo)
static void ksmodel_set_next_bin_edge(struct kshark_trace_histo *histo,
size_t bin, size_t last_row)
{
- uint64_t time_min, time_max;
+ int64_t time_min, time_max;
size_t next_bin = bin + 1;
ssize_t row;
@@ -598,9 +598,9 @@ void ksmodel_shift_backward(struct kshark_trace_histo *histo, size_t n)
* @param histo: Input location for the model descriptor.
* @param ts: position in time to be visualized.
*/
-void ksmodel_jump_to(struct kshark_trace_histo *histo, uint64_t ts)
+void ksmodel_jump_to(struct kshark_trace_histo *histo, int64_t ts)
{
- uint64_t min, max, range_min;
+ int64_t min, max, range_min;
if (ts > histo->min && ts < histo->max) {
/*
@@ -58,16 +58,16 @@ struct kshark_trace_histo {
* Lower edge of the time-window to be visualized. Only entries having
* timestamp >= min will be visualized.
*/
- uint64_t min;
+ int64_t min;
/**
* Upper edge of the time-window to be visualized. Only entries having
* timestamp <= max will be visualized.
*/
- uint64_t max;
+ int64_t max;
/** The size in time for each bin. */
- uint64_t bin_size;
+ int64_t bin_size;
/** Number of bins. */
int n_bins;
@@ -78,7 +78,7 @@ void ksmodel_init(struct kshark_trace_histo *histo);
void ksmodel_clear(struct kshark_trace_histo *histo);
void ksmodel_set_bining(struct kshark_trace_histo *histo,
- size_t n, uint64_t min, uint64_t max);
+ size_t n, int64_t min, int64_t max);
void ksmodel_fill(struct kshark_trace_histo *histo,
struct kshark_entry **data, size_t n);
@@ -89,7 +89,7 @@ void ksmodel_shift_forward(struct kshark_trace_histo *histo, size_t n);
void ksmodel_shift_backward(struct kshark_trace_histo *histo, size_t n);
-void ksmodel_jump_to(struct kshark_trace_histo *histo, uint64_t ts);
+void ksmodel_jump_to(struct kshark_trace_histo *histo, int64_t ts);
void ksmodel_zoom_out(struct kshark_trace_histo *histo,
double r, int mark);
@@ -163,16 +163,16 @@ ksmodel_get_task_missed_events(struct kshark_trace_histo *histo,
struct kshark_entry_collection *col,
ssize_t *index);
-static inline double ksmodel_bin_time(struct kshark_trace_histo *histo,
+static inline int64_t ksmodel_bin_ts(struct kshark_trace_histo *histo,
int bin)
{
- return (histo->min + bin*histo->bin_size) * 1e-9;
+ return (histo->min + bin*histo->bin_size);
}
-static inline uint64_t ksmodel_bin_ts(struct kshark_trace_histo *histo,
+static inline double ksmodel_bin_time(struct kshark_trace_histo *histo,
int bin)
{
- return (histo->min + bin*histo->bin_size);
+ return ksmodel_bin_ts(histo, bin) * 1e-9;
}
#ifdef __cplusplus
All variables that are used to describe the state of the model, like the range of the model or the size of the bin must have signed integer types. This is a continuation of the change started by switching to signed timestamps. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> --- src/libkshark-model.c | 12 ++++++------ src/libkshark-model.h | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-)