perf. improvements in plot_raw_custom_data() / ravg_store()

This commit is contained in:
Stefan Frederik 2022-10-17 15:17:47 +02:00
parent ea359b8c92
commit dad83010f0
3 changed files with 46 additions and 65 deletions

View File

@ -645,12 +645,12 @@ static double ravg_store(int what , int i, int p, int last, double value)
static double **arr = NULL;
int j;
if(what == 0 && imax) {
for(j = 0; j < imax; j++) {
my_free(1512, &arr[j]);
}
my_free(1513, &arr);
imax = 0;
/*
dbg(0, "ravg_store: what= %d i= %d p= %d last= %d value=%g\n",
what, i, p, last, value);
*/
if(what == 2) {
return arr[i][p];
} else if(what == 1) {
if(i >= imax) {
int new_size = i + 4;
@ -661,8 +661,12 @@ static double ravg_store(int what , int i, int p, int last, double value)
imax = new_size;
}
arr[i][p] = value;
} else if(what == 2) {
return arr[i][p];
} else if(what == 0 && imax) {
for(j = 0; j < imax; j++) {
my_free(1512, &arr[j]);
}
my_free(1513, &arr);
imax = 0;
}
return 0.0;
}
@ -860,11 +864,11 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr)
ravg_store(1, i, p, last, result);
while(stack1[i].prevp <= last && x[p] - x[stack1[i].prevp] > stack2[stackptr2 - 1]) {
dbg(1, "%g --> %g\n", x[stack1[i].prevp], x[p]);
/* dbg(1, "%g --> %g\n", x[stack1[i].prevp], x[p]); */
stack1[i].prevp++;
}
stack2[stackptr2 - 2] = (result - ravg_store(2, i, stack1[i].prevp, 0, 0)) / stack2[stackptr2 - 1];
dbg(1, "result=%g ravg_store=%g\n", result, ravg_store(2, i, stack1[i].prevp, 0, 0));
/* dbg(1, "result=%g ravg_store=%g\n", result, ravg_store(2, i, stack1[i].prevp, 0, 0)); */
stackptr2--;
break;
case POW:

File diff suppressed because one or more lines are too long

View File

@ -14,30 +14,6 @@ L 4 40 0 60 0 {}
L 4 -60 30 -40 30 {}
L 4 -40 -50 40 0 {}
L 4 -40 50 40 0 {}
L 4 17.5 45 37.5 45 {}
L 4 37.5 15 37.5 45 {}
L 4 37.5 15 57.5 15 {}
L 4 17.5 30 57.5 30 {dash=3}
L 4 37.5 45 55 45 {dash=3}
L 6 53.75 17.5 53.75 42.5 {}
L 6 52.5 17.5 53.75 17.5 {}
L 6 52.5 17.5 53.75 15 {}
L 6 53.75 15 55 17.5 {}
L 6 53.75 17.5 55 17.5 {}
L 6 53.75 42.5 55 42.5 {}
L 6 53.75 45 55 42.5 {}
L 6 52.5 42.5 53.75 45 {}
L 6 52.5 42.5 53.75 42.5 {}
L 7 10 40 60 40 {}
L 8 43.75 32.5 43.75 37.5 {}
L 8 42.5 32.5 43.75 32.5 {}
L 8 42.5 32.5 43.75 30 {}
L 8 43.75 30 45 32.5 {}
L 8 43.75 32.5 45 32.5 {}
L 8 43.75 37.5 45 37.5 {}
L 8 43.75 40 45 37.5 {}
L 8 42.5 37.5 43.75 40 {}
L 8 42.5 37.5 43.75 37.5 {}
B 5 -62.5 -32.5 -57.5 -27.5 {name=PLUS dir=in }
B 5 57.5 -2.5 62.5 2.5 {name=OUT dir=out }
B 5 -62.5 27.5 -57.5 32.5 {name=MINUS dir=in }
@ -49,5 +25,5 @@ T {MINUS} -38.75 18.5 0 0 0.2 0.2 {}
T {GAIN=@GAIN
ROUT=@ROUT
COUT=@COUT} 28 -46 0 0 0.2 0.2 {}
T {@OFFSET} 57.5 30 0 0 0.15 0.15 {layer=8}
T {@AMPLITUDE} 55 18.75 0 0 0.15 0.15 {layer=6}
T {OFFSET=@OFFSET} 8.75 32.5 0 0 0.2 0.2 {}
T {AMPLITUDE=@AMPLITUDE} 8.75 21.25 0 0 0.2 0.2 {}