Skip to content

Commit

Permalink
review feedback, try to simplify impl
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Oct 25, 2023
1 parent 1b55f1f commit e365136
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Plot/src/main/java/io/deephaven/plot/Figure.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
*/
/****************************************************************************************************************************
****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - Run GenerateFigureImmutable or "./gradlew :Generators:generateFigureImmutable" to regenerate
Expand Down
2 changes: 1 addition & 1 deletion Plot/src/main/java/io/deephaven/plot/FigureImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
*/
/****************************************************************************************************************************
****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - Run GenerateFigureImmutable or "./gradlew :Generators:generateFigureImmutable" to regenerate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
*/
/****************************************************************************************************************************
****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - Run GeneratePlottingConvenience or "./gradlew :Generators:generatePlottingConvenience" to regenerate
Expand Down
24 changes: 12 additions & 12 deletions Stats/src/main/java/io/deephaven/stats/StatsCPUCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
package io.deephaven.stats;

import io.deephaven.base.verify.Assert;
import io.deephaven.configuration.Configuration;
import io.deephaven.internal.log.LoggerFactory;
import io.deephaven.io.logger.Logger;
Expand Down Expand Up @@ -223,32 +224,31 @@ private boolean peekNextLong() {
*/
private void readToBuffer(FileChannel fileChannel, String fileName) throws IOException {
statBuffer.clear();
int nb = 0;
fileChannel.position(0);

// Filesystem entries in /proc can only be read all at once to avoid races, so using too big of a buffer isn't a
// problem, but too small is. Attempt to read with the current buffer. If we filled the buffer we resize it and
// read again from start.
while (true) {
final int thisNb = fileChannel.read(statBuffer);
final int nb = fileChannel.read(statBuffer);

if (thisNb == -1) {
break;
if (nb == -1) {
// EOF means success, set position to zero and limit to the data read
statBuffer.flip();
return;
}
if (nb == 0) {
// zero bytes read is an error, proc isn't working correctly?
throw new IOException(fileName + " zero read");
}
nb += thisNb;
if (!statBuffer.hasRemaining()) {
// allocate larger read-buffer, and read again from start
statBuffer = ByteBuffer.allocate(statBuffer.capacity() * 2);
fileChannel.position(0);
} else {
Assert.eq(statBuffer.position(), "statBuffer.position()", nb, "nb");
}
}

if (nb == 0) {
throw new IOException(fileName + " zero read");
} else {
// Success, set position and limit to the data read
statBuffer.flip();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
*/
/****************************************************************************************************************************
****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - Run GroovyStaticImportGenerator or "./gradlew :Generators:groovyStaticImportGenerator" to regenerate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.server.hierarchicaltable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.server.notebook;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.server.partitionedtable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.server.plugin.js;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.server.plugin.js;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2016-2021 Deephaven Data Labs and Patent Pending
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/

package io.deephaven.server.barrage;

import com.google.protobuf.ByteString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.api;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.api;

Expand Down

0 comments on commit e365136

Please sign in to comment.