Skip to content

Instantly share code, notes, and snippets.

View clohfink's full-sized avatar

Chris Lohfink clohfink

View GitHub Profile
### Keybase proof
I hereby claim:
* I am clohfink on github.
* I am clohfink (https://keybase.io/clohfink) on keybase.
* I have a public key ASBMVgXJ55fnahgb7tAViS8F-8hwuLeXFbs2Y4rMmz4oQAo
To claim this, I am signing this object:
CREATE OR REPLACE FUNCTION topkState ( state tuple<int, map<text, int>>, val text )
CALLED ON NULL INPUT RETURNS tuple<int, map<text, int>> LANGUAGE java AS '
java.util.Map<String, Integer> m = state.getMap(1, String.class, Integer.class);
int current = m.get(val) == null? 1 : m.get(val) + 1;
if (val != null) {
state.setInt(0, state.getInt(0) + 1);
if (state.getInt(0) < 100) {
m.put(val, current);
}
else {
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Benchmark)
public class ThreadLocalBenchmark {
@State(Scope.Benchmark)
public static class ThreadLocalExecutorPool extends JMXEnabledThreadPoolExecutor {
protected final ThreadLocal<Long> startTime = new ThreadLocal<Long>();
public final Counter wallTime;
private ThreadMXBean bean;
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Benchmark)
public class ThreadLocalBenchmark {
@State(Scope.Benchmark)
public static class ThreadLocalExecutorPool extends JMXEnabledThreadPoolExecutor {
protected final ThreadLocal<Long> startTime = new ThreadLocal<Long>();
public final Counter wallTime;
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Benchmark)
public class ThreadLocalBenchmark {
@State(Scope.Benchmark)
public static class ThreadLocalExecutorPool extends JMXEnabledThreadPoolExecutor {
protected final ThreadLocal<Long> startTime = new ThreadLocal<Long>();
public final Counter wallTime;
public final Meter tasksAdded;
@clohfink
clohfink / cassandra_cfstats_histogram.py
Last active December 20, 2015 03:59 — forked from Kami/cassandra_cfstats_histogram.py
Changed to just make bar graph. With large values histogram version takes multiple GB of ram
#!/usr/bin/env python
# Licensed to Tomaz Muraus under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Tomaz muraus 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
#