performance improvements in draw_graph functions

This commit is contained in:
Stefan Frederik 2022-01-06 03:56:11 +01:00
parent 7f1a085656
commit c3f59beec1
1 changed files with 9 additions and 9 deletions

View File

@ -1768,7 +1768,7 @@ int schematic_waves_loaded(void)
return 0; return 0;
} }
void get_bus_value(int n_bits, int hex_digits, int *idx_arr, int p, char *busval, double vth) void get_bus_value(int n_bits, int hex_digits, SPICE_DATA **idx_arr, int p, char *busval, double vth)
{ {
double val; double val;
int i; int i;
@ -1779,7 +1779,7 @@ void get_bus_value(int n_bits, int hex_digits, int *idx_arr, int p, char *busval
register SPICE_DATA ** gv = xctx->graph_values; register SPICE_DATA ** gv = xctx->graph_values;
for(i = n_bits - 1; i >= 0; i--) { for(i = n_bits - 1; i >= 0; i--) {
val = gv[idx_arr[i]][p]; val = idx_arr[i][p];
hexdigit |= (val > vth); hexdigit |= (val > vth);
if(bin < 3) { if(bin < 3) {
bin++; bin++;
@ -1801,14 +1801,14 @@ void get_bus_value(int n_bits, int hex_digits, int *idx_arr, int p, char *busval
/* idx_arr malloc-ated and returned, caller must free! */ /* idx_arr malloc-ated and returned, caller must free! */
static int *get_bus_idx_array(const char *ntok, int *n_bits) static SPICE_DATA **get_bus_idx_array(const char *ntok, int *n_bits)
{ {
int *idx_arr =NULL; SPICE_DATA **idx_arr =NULL;
int p; int p;
char *ntok_savep, *ntok_ptr, *ntok_copy = NULL; char *ntok_savep, *ntok_ptr, *ntok_copy = NULL;
const char *bit_name; const char *bit_name;
*n_bits = count_items(ntok, ",") - 1; *n_bits = count_items(ntok, ",") - 1;
idx_arr = my_malloc(1454, (*n_bits) * sizeof(int)); idx_arr = my_malloc(1454, (*n_bits) * sizeof(SPICE_DATA *));
p = 0; p = 0;
my_strdup2(1402, &ntok_copy, ntok); my_strdup2(1402, &ntok_copy, ntok);
ntok_ptr = ntok_copy; ntok_ptr = ntok_copy;
@ -1816,7 +1816,7 @@ static int *get_bus_idx_array(const char *ntok, int *n_bits)
while( (bit_name = my_strtok_r(NULL, ",", &ntok_savep)) ) { while( (bit_name = my_strtok_r(NULL, ",", &ntok_savep)) ) {
int idx; int idx;
if( (idx = get_raw_index(bit_name)) != -1) { if( (idx = get_raw_index(bit_name)) != -1) {
idx_arr[p] = idx; idx_arr[p] = xctx->graph_values[idx];
} }
p++; p++;
} }
@ -1828,7 +1828,7 @@ static int *get_bus_idx_array(const char *ntok, int *n_bits)
* following are bits that are bundled together: * following are bits that are bundled together:
LDA,LDA[3],LDA[2],LDA1],LDA[0] LDA,LDA[3],LDA[2],LDA1],LDA[0]
*/ */
static void draw_graph_bus_points(const char *ntok, int n_bits, int *idx_arr, static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx_arr,
int first, int last, int wave_col, int sweep_idx, int wcnt, int n_nodes, Graph_ctx *gr) int first, int last, int wave_col, int sweep_idx, int wcnt, int n_nodes, Graph_ctx *gr)
{ {
int p; int p;
@ -2254,7 +2254,7 @@ static void draw_graph_variables(int wcnt, int wave_color, int n_nodes, int swee
} }
static void show_node_measures(int measure_p, double measure_x, double measure_prev_x, static void show_node_measures(int measure_p, double measure_x, double measure_prev_x,
const char *bus_msb, int wave_color, int idx, int *idx_arr, const char *bus_msb, int wave_color, int idx, SPICE_DATA **idx_arr,
int n_bits, int n_nodes, const char *ntok, int wcnt, Graph_ctx *gr) int n_bits, int n_nodes, const char *ntok, int wcnt, Graph_ctx *gr)
{ {
char tmpstr[1024]; char tmpstr[1024];
@ -2368,7 +2368,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr)
double start; double start;
double end; double end;
int n_bits = 1, wrap; int n_bits = 1, wrap;
int *idx_arr = NULL; SPICE_DATA **idx_arr = NULL;
int sweepvar_wrap = 0; /* incremented on new dataset or sweep variable wrap */ int sweepvar_wrap = 0; /* incremented on new dataset or sweep variable wrap */
XPoint *point = NULL; XPoint *point = NULL;