Package one.nio.os.perf
Class PerfCounter
- java.lang.Object
-
- one.nio.os.perf.PerfCounter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
PerfCounterGlobal
public class PerfCounter extends java.lang.Object implements java.io.Closeable
-
-
Field Summary
Fields Modifier and Type Field Description private PerfEventevent(package private) intfd(package private) static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<PerfCounter>fdUpdaterprotected longreadFormatprivate RingBufferringBuffer
-
Constructor Summary
Constructors Constructor Description PerfCounter(PerfEvent event, RingBuffer ringBuffer, long readFormat, int fd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachBpf(int fd)voidclose()voiddisable()voidenable()PerfEventevent()longget()protected long[]getRawValue()CounterValuegetValue()booleanhasReadFormat(int readFormat)(package private) voidioctl(int cmd, int arg)protected long[]newBuffer()PerfSamplenextSample()voidrefresh(int count)voidreset()protected LocalValuetoValue(long[] raw)
-
-
-
Field Detail
-
event
private final PerfEvent event
-
ringBuffer
private final RingBuffer ringBuffer
-
readFormat
protected final long readFormat
-
fd
volatile int fd
-
fdUpdater
static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<PerfCounter> fdUpdater
-
-
Constructor Detail
-
PerfCounter
PerfCounter(PerfEvent event, RingBuffer ringBuffer, long readFormat, int fd)
-
-
Method Detail
-
event
public final PerfEvent event()
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
get
public long get() throws java.io.IOException- Throws:
java.io.IOException
-
getValue
public CounterValue getValue() throws java.io.IOException
- Throws:
java.io.IOException
-
getRawValue
protected long[] getRawValue() throws java.io.IOException- Throws:
java.io.IOException
-
newBuffer
protected long[] newBuffer()
-
toValue
protected LocalValue toValue(long[] raw)
-
hasReadFormat
public boolean hasReadFormat(int readFormat)
-
nextSample
public PerfSample nextSample()
-
reset
public void reset() throws java.io.IOException- Throws:
java.io.IOException
-
attachBpf
public void attachBpf(int fd) throws java.io.IOException- Throws:
java.io.IOException
-
enable
public void enable() throws java.io.IOException- Throws:
java.io.IOException
-
disable
public void disable() throws java.io.IOException- Throws:
java.io.IOException
-
refresh
public void refresh(int count) throws java.io.IOException- Throws:
java.io.IOException
-
ioctl
void ioctl(int cmd, int arg) throws java.io.IOException- Throws:
java.io.IOException
-
-