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
// System Headers | |
#include <iostream> | |
#include <stdio.h> | |
#include <string> | |
#include <stdint.h> | |
#include <sys/time.h> | |
// Third-Party Headers | |
#include <zmq.hpp> |
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
// System Headers | |
#include <iostream> | |
#include <stdio.h> | |
#include <string> | |
#include <stdint.h> | |
#include <sys/time.h> | |
// Third-Party Headers | |
#include <zmq.hpp> |
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
#include <string> | |
#include <strings.h> | |
#include <stdint.h> | |
std::string hexDump( zmq::message_t & aMessage ) { | |
// I'm going to build a hex/ascii dump like you've seen so many times before | |
std::string msg; | |
std::string ascii; | |
// get the pointer to the start of the message's payload - and it's size | |
char *buff = (char *)aMessage.data(); |
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
/** | |
* On my CentOS 5 system this application sent the first 3000 messages | |
* with a running memory footprint less than 7 MB. In a few minutes, it | |
* leveled out at 18MB. Based on the sending rate, the maximum data rate | |
* out of this process should be less than 75kbps -- well below the | |
* ZMQ_RATE of 10Mbps. While there doesn't seem to be a long-term leak, | |
* the fact that this application does the first 3000 sends with a memory | |
* footprint far less than it's terminal value is concerning. | |
* | |
* If I change nothing other than the ZMQ_RATE value and change it to |
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
// System Headers | |
#include <iostream> | |
#include <stdio.h> | |
#include <string> | |
#include <stdint.h> | |
#include <sys/time.h> | |
// Third-Party Headers | |
#include <zmq.hpp> |
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
/** | |
* LinkedFIFO.h - this file defines a multi-producer/single-consumer linked | |
* FIFO queue and is using the compare-and-swap to achieve | |
* the lock-free goal. | |
*/ | |
#ifndef __LINKEDFIFO_H | |
#define __LINKEDFIFO_H | |
// System Headers | |
#include <stdint.h> |
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
/** | |
* RingFIFO.h - this file defines a multi-producer/single-consumer circular | |
* FIFO queue and is using the compare-and-swap to achieve | |
* the lock-free goal. The size of this buffer is given as a | |
* power of 2 - so saying: | |
* RingFIFO<int, 10> a; | |
* makes a ring buffer of 2^10 = 1024 ints. | |
*/ | |
#ifndef __RINGFIFO_H | |
#define __RINGFIFO_H |
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
/** | |
* RingFIFO.h - this file defines a multi-producer/single-consumer circular | |
* FIFO queue and is using the compare-and-swap to achieve | |
* the lock-free goal. The size of this buffer is given as a | |
* power of 2 - so saying: | |
* RingFIFO<int, 10> a; | |
* makes a ring buffer of 2^10 = 1024 ints. | |
*/ | |
#ifndef __RINGFIFO_H | |
#define __RINGFIFO_H |
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
-module(ring). | |
-export([start/0, test/2]). | |
%% make the state container for the ring node | |
-record(state, {next, origin, caller}). | |
%% standard entry point for a 1000 node, 500 cycle test | |
start() -> | |
test(1000, 500). |
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
/** | |
* ring.cpp - this is the C++ equivalent of the Armstrong Chapter 8 | |
* exercise where you are supposed to make a ring of 'n' | |
* objects and have one fire another for a total of 'm' laps. | |
*/ | |
// System Headers | |
#include <stdint.h> | |
#include <iostream> | |
#include <sys/time.h> |
OlderNewer