Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
package Benchmark;
import org.epics.pvaClient.PvaClient;
import org.epics.pvaClient.PvaClientPut;
import org.epics.pvaClient.PvaClientPutData;
public class myPVAClient_Scalar {
public static void main(String[] args) {
String providerName = "pva";
PvaClient pva = PvaClient.get(providerName);
String recordName = "myScalarDouble";
long timeAtStartOfWhile, timePassedInWhileLoop;
double oneSecond = Math.pow(10, 9); // duration of 1 s in nano seconds
double putThisManySamples = 1000.0;
try {
PvaClientPut put = pva.channel(recordName, providerName).put();
PvaClientPutData putData = put.getData();
double[] delaysBetweenTwoSamples = new double[]{0.1}; //, 0.1, 0.01};
double value = 0.0;
for (double delay : delaysBetweenTwoSamples) {
timeAtStartOfWhile = System.nanoTime();
timePassedInWhileLoop = 0;
while (timePassedInWhileLoop <= putThisManySamples * oneSecond) {
value++;
putData.putDouble(value);
put.put();
if (delay > 0) {
try {
Thread.sleep((long) (delay * 1000.0));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
timePassedInWhileLoop = System.nanoTime() - timeAtStartOfWhile;
} // end of WHILE loop
} // end of FOR loop
} catch (RuntimeException e) {
System.err.println("exception " + e.getMessage());
e.printStackTrace(System.err);
System.exit(1);;
}
System.out.println("\n_____putting data to the PV " + recordName + " is done_______");
pva.destroy();
}
}