This file contains hidden or 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
function findThingsInAHashMap(map, things, entryComparator, keyTransformer, entryCallback) { | |
var results = {}; | |
var mapAsArray = toArray(map.table) | |
for(i = 0; i < mapAsArray.length; i++) { | |
var e = mapAsArray[i]; | |
while (e != null) { | |
if(e.key != null && entryComparator(e, things)) { | |
var tempResult = entryCallback(e.key, e.value); // NOTE some hashmap implementations use e.val vs. value, so check first! | |
if (tempResult != null) { | |
results[keyTransformer(e.key)] = tempResult; |
This file contains hidden or 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
function getProducerStats(topic) { | |
var kafkaProducers = heap.objects('org.apache.kafka.clients.producer.KafkaProducer', false); | |
while(kafkaProducers.hasMoreElements()) { | |
var next = kafkaProducers.nextElement(); | |
if (next.clientId.toString().contains(topic)) { | |
return printProducerStats(next.metrics.metrics); | |
} | |
} | |
} | |
function printKafkaMetric(value) { |
This file contains hidden or 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
------------- Summary ------------- | |
Total Free Chunked Memory:4365301296 | |
Total Chunked Avbl Memory:17963147264 | |
Total Memory Utilization:76% |
This file contains hidden or 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
MALLOC_CONF="dirty_decay_ms:0" LD_PRELOAD=/usr/local/lib/libjemalloc.so ./memory-demo |
This file contains hidden or 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
#include <stdio.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
// Define constants to make sure strings are not allocated at the top of the heap | |
#define HIT_ENTER "Press Enter to continue...\n" | |
#define ALLOCATED "500k 5KB chunks were just provisioned\n" | |
#define FREED "The first allocations were just free()'d.\n" |