-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VL] In OAP Velox fork, simplify shrinking/spilling code for Velox me…
…mory pool (#3586)
- Loading branch information
1 parent
81fae1e
commit 27defd8
Showing
9 changed files
with
130 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
gluten-data/src/main/java/io/glutenproject/memory/nmm/LoggingReservationListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.glutenproject.memory.nmm; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
// For debugging purpose only | ||
public class LoggingReservationListener implements ReservationListener { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(LoggingReservationListener.class); | ||
|
||
private final ReservationListener delegated; | ||
|
||
public LoggingReservationListener(ReservationListener delegated) { | ||
this.delegated = delegated; | ||
} | ||
|
||
@Override | ||
public long reserve(long size) { | ||
long before = getUsedBytes(); | ||
long reserved = delegated.reserve(size); | ||
long after = getUsedBytes(); | ||
LOGGER.info( | ||
String.format( | ||
"Reservation[%s]: %d + %d(%d) = %d", this.toString(), before, reserved, size, after)); | ||
return reserved; | ||
} | ||
|
||
@Override | ||
public long unreserve(long size) { | ||
long before = getUsedBytes(); | ||
long unreserved = delegated.unreserve(size); | ||
long after = getUsedBytes(); | ||
LOGGER.info( | ||
String.format( | ||
"Unreservation[%s]: %d - %d(%d) = %d", | ||
this.toString(), before, unreserved, size, after)); | ||
return unreserved; | ||
} | ||
|
||
@Override | ||
public long getUsedBytes() { | ||
return delegated.getUsedBytes(); | ||
} | ||
} |
Oops, something went wrong.