Merge restart branch (#132)

* binary store count

Fix issue in binary store object count

* update V10aa/other for testing

* update V10aa/other for testing

* reenable buffer dumping

* update V to 10ac for testing

* Additional diagnostics

Additional output of CPU usage for each module when stopping

* V 2.02.10ad for testing

Fixed issue of finding correct raw data block
This commit is contained in:
Douglas Gillespie 2024-03-15 11:45:48 +00:00 committed by GitHub
parent cc486866bb
commit 29035e0b03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 42 additions and 5 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId> <groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId> <artifactId>Pamguard</artifactId>
<version>2.02.10b</version> <version>2.02.10ad</version>
<name>Pamguard Java12+</name> <name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description> <description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url> <url>www.pamguard.org</url>

View File

@ -184,6 +184,23 @@ public class PamConfiguration {
return dataBlock; return dataBlock;
} }
} }
return tryShortName(blockType, name);
}
/**
* For backwards compatibility, some blocks may still use the short name.
* @param blockType
* @param name
* @return
*/
private PamDataBlock tryShortName(Class blockType, String name) {
if (name == null) return null;
ArrayList<PamDataBlock> blocks = getDataBlocks(blockType, true);
for (PamDataBlock dataBlock:blocks) {
if (name.equals(dataBlock.getDataName())) { // check for a long name match first
return dataBlock;
}
}
return null; return null;
} }

View File

@ -196,7 +196,7 @@ public class PamController implements PamControllerInterface, PamSettings {
private Timer diagnosticTimer; private Timer diagnosticTimer;
private boolean debugDumpBufferAtRestart = false; private boolean debugDumpBufferAtRestart = true;
private NetworkController networkController; private NetworkController networkController;
private int nNetPrepared; private int nNetPrepared;
@ -1434,7 +1434,7 @@ public class PamController implements PamControllerInterface, PamSettings {
pamControlledUnits.get(iU).flushDataBlockBuffers(2000); pamControlledUnits.get(iU).flushDataBlockBuffers(2000);
} }
} }
dumpBufferStatus("In pamStopped, now idle", true); dumpBufferStatus("In pamStopped, now idle", false);
// wait here until the status has changed to Pam_Idle, so that we know // wait here until the status has changed to Pam_Idle, so that we know
// that we've really finished processing all data // that we've really finished processing all data

View File

@ -31,12 +31,12 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release. * Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f' * Note: can't go higher than sub-release 'f'
*/ */
static public final String version = "2.02.10b"; static public final String version = "2.02.10ad";
/** /**
* Release date * Release date
*/ */
static public final String date = "2 March 2024"; static public final String date = "13 March 2024";
// /** // /**
// * Release type - Beta or Core // * Release type - Beta or Core

View File

@ -4296,6 +4296,9 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
* @param sayEmpties dump info even if a buffer is empty (otherwise, only ones that have stuff still) * @param sayEmpties dump info even if a buffer is empty (otherwise, only ones that have stuff still)
*/ */
public void dumpBufferStatus(String message, boolean sayEmpties) { public void dumpBufferStatus(String message, boolean sayEmpties) {
if (sayEmpties || unitsAdded > 0) {
System.out.printf("Datablock %s: Added %d data units\n", getLongDataName(), unitsAdded);
}
int nObs = countObservers(); int nObs = countObservers();
for (int i = 0; i < nObs; i++) { for (int i = 0; i < nObs; i++) {
PamObserver obs = getPamObserver(i); PamObserver obs = getPamObserver(i);

View File

@ -126,6 +126,8 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator {
private long cpuUsage; private long cpuUsage;
private long lastCPUCheckTime = System.currentTimeMillis(); private long lastCPUCheckTime = System.currentTimeMillis();
private double cpuPercent; private double cpuPercent;
private double totalCPU, peakCPU;
private int nCPU;
/** /**
* Flag for the process to say whether or not it's primary data connection * Flag for the process to say whether or not it's primary data connection
@ -140,6 +142,11 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator {
* Last received data unit - used for working out timing offsets. * Last received data unit - used for working out timing offsets.
*/ */
private PamDataUnit lastAcousticDataunit; private PamDataUnit lastAcousticDataunit;
/*
* diagnostic count of all data processed
*/
private int nDataProcessed;
// some flags and variables needed to deal with conversion from // some flags and variables needed to deal with conversion from
// milliseconds to samples and back // milliseconds to samples and back
// private boolean acousticDataSource = false; // private boolean acousticDataSource = false;
@ -742,6 +749,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator {
} }
// long cpuStart = SystemTiming.getProcessCPUTime(); // long cpuStart = SystemTiming.getProcessCPUTime();
long threadId = Thread.currentThread().getId(); long threadId = Thread.currentThread().getId();
nDataProcessed++;
long cpuStart = tmxb.getThreadCpuTime(threadId); long cpuStart = tmxb.getThreadCpuTime(threadId);
newData(o, arg); newData(o, arg);
if (processCheck != null) { if (processCheck != null) {
@ -762,6 +770,12 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator {
* get percent. Total is -9+3+2 = /!0^4 ! * get percent. Total is -9+3+2 = /!0^4 !
*/ */
cpuPercent = (double) cpuUsage / (now - lastCPUCheckTime) / 10000.; cpuPercent = (double) cpuUsage / (now - lastCPUCheckTime) / 10000.;
// these next two allow us to take an average cpu.
totalCPU += cpuPercent;
nCPU++;
// and hte max cpu (may always go to 100 at end ?)
peakCPU = Math.max(cpuPercent, peakCPU);
lastCPUCheckTime = now; lastCPUCheckTime = now;
cpuUsage = 0; cpuUsage = 0;
} }
@ -1073,6 +1087,9 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator {
* @param sayEmpties include info even if a buffer is empty. * @param sayEmpties include info even if a buffer is empty.
*/ */
public void dumpBufferStatus(String message, boolean sayEmpties) { public void dumpBufferStatus(String message, boolean sayEmpties) {
if (sayEmpties || nDataProcessed > 0) {
System.out.printf("Process %s: ran %d datas, peak CPU %3.1f%%, mean CPU %3.1f%%\n", this.getProcessName(), nDataProcessed, peakCPU, totalCPU/nCPU);
}
ArrayList<PamDataBlock> outputs = getOutputDataBlocks(); ArrayList<PamDataBlock> outputs = getOutputDataBlocks();
try { try {
for (PamDataBlock output : outputs) { for (PamDataBlock output : outputs) {