原子操作你好。
我正在尝试测量此过滤器的已用时间(计算列'PowerRail'的10秒移动平均值):
...
tStart = HP Time();
new_col << Formula( Summation( i = 1,10,Lag(dt:PowerRail,i))/10);
tStop = HP Time();
...
似乎不是线性地进行,而是调用新线程并且不实现完成操作的实际时间。
就目前而言,测量200uS是不现实的。带有“PowerRail”列的CSV文件大小为11GB。200uS更有可能是调用新线程的时候。
在脚本结束时,JMP表打开,移动平均值显示在表的可见区域中,但如果我向下滚动,我会看到公式没有完全处理整个列。
是否可以在原子操作中运行公式,即不在不同的线程中运行公式,以便测量实际完成时间?
提前致谢。
回复:原子操作这只是一个FYI,你是在互动地看待表现。使用JMP调试器运行脚本,然后在井号#上选择看起来像时钟的按钮。它返回步骤中的时间百分比,或完成计算的“步骤”数。下面是脚本,时间差和调试器性能。它表示Col Moving Average()函数是最好的方法。
Names default to here(1);
dt = New Table("Test", New Column("random", numeric), New Column("MA1", numeric),
New Column("MA2", numeric),
New Column("MA3", numeric),
);
dt << add rows(2000000);
xmat = J(2000000, 2, Random Integer(1,10));
dt:random << Set values(xmat[0,1]);
wait(5);
t1 = HP Time();
dt:MA1 << Formula( Summation( i = 1,10,Lag(dt:random,i))/10, <<RUN formula=""></RUN>以下是数字结果:
t4 - t3 = 166; // 使用Col移动平均线
t3 - t2 = 2246576; // 使用For循环
t2 - t1 = 1038; // 使用求和公式除以10
以下是调试器性能报告的屏幕截图

回复:原子操作1H,
感谢你的快速回复。
使用'Run Formulas()',运行过滤器的时间实际上是4个小时!
回复:原子操作在实际评估公式之前,脚本仍然是正确的;通常这是首选,否则你的脚本可能会永远运行。 您可以使用运行公式使脚本等待:
Names default to here( 1 );
//Open sample data and create a column to modify
dt = Open("$Sample_Data/iris.jmp");
new_col = dt << New Column("Test",Numeric,"Continuous",Formula(1));
//Set the column formula
tStart = HP Time();
new_col << Formula( for(i=1,i<=100000, i++, i+1) );
tMiddle = HP Time();
print(tMiddle-tStart);
//Wait for the formula to finish calculating
dt << Run Formulas();
tStop = HP Time();
print(tStop-tStart);