Command line tool that generates random binary data as quickly as possible. Can be piped into a file to test sequential write speeds together with iostat.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
739 B

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "rand.h"
#define BUF_SIZE (16 * 1024 * 1024)
int main(int argc, char** argv) {
unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL}, length=4;
init_by_array64(init, length);
uint8_t* buffer = malloc(BUF_SIZE);
uint64_t counter = 0;
for(;;) {
for(uint64_t i = 0; i < BUF_SIZE; i += 8) {
uint64_t r = genrand64_int64();
*((uint64_t*) &buffer[i]) = r;
}
fwrite(buffer, BUF_SIZE, 1, stdout);
counter += BUF_SIZE;
if((counter & 1073741823) == 0) {
fprintf(stderr, "Wrote %lld GiB\n", counter / 1073741824);
}
}
return 0;
}