azagrebin commented on a change in pull request #13316:
URL: https://github.com/apache/flink/pull/13316#discussion_r487748346



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
##########
@@ -271,12 +271,28 @@ public int getTotalNumberOfMemorySegments() {
                return totalNumberOfMemorySegments;
        }
 
+       public long getTotalMemory() {
+               return getTotalNumberOfMemorySegments() * memorySegmentSize;
+       }
+
        public int getNumberOfAvailableMemorySegments() {
                synchronized (availableMemorySegments) {
                        return availableMemorySegments.size();
                }
        }
 
+       public long getAvailableMemory() {
+               return getNumberOfAvailableMemorySegments() * memorySegmentSize;
+       }
+
+       public int getNumberOfUsedMemorySegments() {
+               return getTotalNumberOfMemorySegments() - 
getNumberOfAvailableMemorySegments();
+       }
+
+       public long getUsedMemory() {
+               return getNumberOfUsedMemorySegments() * memorySegmentSize;
+       }

Review comment:
       I tend to agree with @NicoK. As I understand, we want to expose the 
'used' metric per TM. In that sense, if some buffers are already reserved for a 
certain task then they cannot be used for others, so they are not available on 
TM level. The 'used' buffers (containing records to process, I guess) per 
task/channel should be a metric on task/channel level, otherwise it is hard to 
judge what 'available' actually means.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to