Skip to content

Instantly share code, notes, and snippets.

@epickrram
epickrram / framework-server-perf-flames.svg
Created March 10, 2017 08:12
framework-server-perf-flames.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;
public final class SynchronisationThroughputTest
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.method.MethodList;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.scaffold.InstrumentedType;
import net.bytebuddy.implementation.Implementation;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.Origin;
/**
* Callback for UDP-specific statistics in /proc/net/snmp.
*/
@FunctionalInterface
public interface SnmpUdpStatisticsHandler
{
/**
* Callback method.
* @param inErrors InErrors count
* @param receiveBufferErrors RecvbufErrors count
/**
* Callback for statistics from /proc/net/softnet_stat.
*/
@FunctionalInterface
public interface SoftnetStatsHandler
{
/**
* Callback method.
* @param cpuId zero-based CPU that these statistics refer to
* @param processed softIRQ events processed
udpSocketMonitor.beginMonitoringOf(InetAddress.getByName("239.193.50.102"));
/**
* Handler for socket statistics from /proc/net/udp.
*/
@FunctionalInterface
public interface UdpSocketStatisticsHandler
{
/**
* Callback method.
* @param inetAddress the ip address
* @param port the socket port
@epickrram
epickrram / ExampleLogic.java
Created January 27, 2016 11:55
Example for a blog post
public void performMatching(final Order order) {
transactionReporter.startOfTransaction()
order.executeAggressively(orderBook);
tradeReporter.reportTrades(order.getTrades());
engine.updateAggregateOrderStatistics();
transactionReporter.endOfTransaction();
@epickrram
epickrram / xfs_write_with_lock.c
Created December 9, 2015 12:09
xfs_write_lock
xfs_file_buffered_aio_write(
struct kiocb *iocb,
struct iov_iter *from)
{
...
int iolock = XFS_IOLOCK_EXCL;
...
xfs_rw_ilock(ip, iolock);
...
ret = generic_perform_write(file, from, pos);
@epickrram
epickrram / xfs_file.c
Created December 9, 2015 11:49
xfs_read
xfs_file_read_iter(
struct kiocb *iocb,
struct iov_iter *to)
{
...
xfs_rw_ilock(ip, XFS_IOLOCK_SHARED);
...
ret = generic_file_read_iter(iocb, to);
...
xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);