<commit_before>#define _POSIX_C_SOURCE 200809L
#define _GNU_SOURCE

#include <stdlib.h>
#include <getopt.h>
#include <syslog.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <assert.h>
#include <math.h>

#include "aioRequests.h"
#include "utils.h"
#include "logSpeed.h"
#include "diskStats.h"
#include "positions.h"
#include "cigar.h"
#include "devices.h"
#include "blockVerify.h"

int    keepRunning = 1;       // have we been interrupted
double exitAfterSeconds = 60;
int    qd = 256;
int    qdSpecified = 0;
char   *dataLog = NULL;
char   *benchLog = NULL;
int    dataLogFormat = 0;
int    seqFiles = 1;
int    seqFilesSpecified = 0;
double maxSizeGB = 0;
size_t alignment = 0;
size_t LOWBLKSIZE = 65536;
size_t BLKSIZE = 65536;
int    jumpStep = 0;
int    rrSpecified = 0;
double readRatio = 0.5;
size_t table = 0;
char   *logFNPrefix = NULL;
int    verbose = 0;
int    singlePosition = 0;
int    flushEvery = 0;
int    verifyWrites = 0;
char*  specifiedDevices = NULL;
int    sendTrim = 0;
long   startAtZero = -99999; // -99999 is a special case for random start
size_t maxPositions = 10*1000*1000;
size_t dontUseExclusive = 0;
int    blocksFromEnd = 0;
char*  logPositions = NULL;
long int seed;
char*  cigarPattern = NULL;
cigartype cigar;
int    oneShot = 0;
char   *randomBufferFile = NULL;
int    fsyncAfterWriting = 0;
char   *description = NULL;
int    dontExitOnErrors = 0;

deviceDetails *deviceList = NULL;
size_t deviceCount = 0;

void intHandler(int d) {
  fprintf(stderr,"got signal\n");
  keepRunning = 0;
}



void handle_args(int argc, char *argv[]) {
  int opt;
  seed = (long int) (timedouble());
  if (seed < 0) seed=-seed;
  seed = seed & 0xffff; // only one of 65536 values
  srand48(seed);
  
  while ((opt = getopt(argc, argv, "t:k:o:q:f:s:G:p:Tl:vVS:F0R:O:rwb:MgzP:Xa:L:I:D:JB:C:1Z:Nd:E")) != -1) {
    switch (opt) {
    case 'a':
      alignment = atoi(optarg) * 1024;
      alignment = (alignment >> 1) << 1;
      break;
    case 'd':
      description = strdup(optarg);
      fprintf(stderr,"*info* description: '%s'\n", description);
      break;
    case 'N':
      fsyncAfterWriting = 1;
      break;
    case 'J':
      dataLogFormat = JSON;
      break;
    case 'D':
      dataLog = strdup(optarg);
      break;
    case 'E':
      dontExitOnErrors = 1;
      break;
    case 'B':
      benchLog = strdup(optarg);
      break;
    case 'L':
      logPositions = strdup(optarg);
      break;
    case 'I':
      {}
      size_t added = loadDeviceDetails(optarg, &deviceList, &deviceCount);
      fprintf(stderr,"*info* added %zd devices from file '%s'\n", added, optarg);
      //      inputFilenames = strdup(optarg);
      break;
    case 'X':
      dontUseExclusive++;
      break;
    case 'P':
      maxPositions = atoi(optarg);
      if (verbose) {
	fprintf(stderr,"*info* hard coded maximum number of positions %zd\n", maxPositions);
      }
      break;
    case 'z':
      startAtZero = 0;
      break;
    case 'Z':
      startAtZero = atol(optarg);
      if (startAtZero < 0 && startAtZero != -99999) startAtZero = abs(startAtZero);
      break;
    case 'M':
      dataLogFormat = MYSQL;
      break;
    case 'T':
      table = 1;
      break;
    case 'O':
      if (!specifiedDevices) {
	specifiedDevices = strdup(optarg);
      }
      break;
    case '0':
      maxPositions = 0;
      break;
    case 'r':
      readRatio += 0.5;<commit_msg>Clangism<commit_after>#define _POSIX_C_SOURCE 200809L
#define _GNU_SOURCE

#include <stdlib.h>
#include <getopt.h>
#include <syslog.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <assert.h>
#include <math.h>

#include "aioRequests.h"
#include "utils.h"
#include "logSpeed.h"
#include "diskStats.h"
#include "positions.h"
#include "cigar.h"
#include "devices.h"
#include "blockVerify.h"

int    keepRunning = 1;       // have we been interrupted
double exitAfterSeconds = 60;
int    qd = 256;
int    qdSpecified = 0;
char   *dataLog = NULL;
char   *benchLog = NULL;
int    dataLogFormat = 0;
int    seqFiles = 1;
int    seqFilesSpecified = 0;
double maxSizeGB = 0;
size_t alignment = 0;
size_t LOWBLKSIZE = 65536;
size_t BLKSIZE = 65536;
int    jumpStep = 0;
int    rrSpecified = 0;
double readRatio = 0.5;
size_t table = 0;
char   *logFNPrefix = NULL;
int    verbose = 0;
int    singlePosition = 0;
int    flushEvery = 0;
int    verifyWrites = 0;
char*  specifiedDevices = NULL;
int    sendTrim = 0;
long   startAtZero = -99999; // -99999 is a special case for random start
size_t maxPositions = 10*1000*1000;
size_t dontUseExclusive = 0;
int    blocksFromEnd = 0;
char*  logPositions = NULL;
long int seed;
char*  cigarPattern = NULL;
cigartype cigar;
int    oneShot = 0;
char   *randomBufferFile = NULL;
int    fsyncAfterWriting = 0;
char   *description = NULL;
int    dontExitOnErrors = 0;

deviceDetails *deviceList = NULL;
size_t deviceCount = 0;

void intHandler(int d) {
  fprintf(stderr,"got signal\n");
  keepRunning = 0;
}



void handle_args(int argc, char *argv[]) {
  int opt;
  seed = (long int) (timedouble());
  if (seed < 0) seed=-seed;
  seed = seed & 0xffff; // only one of 65536 values
  srand48(seed);
  
  while ((opt = getopt(argc, argv, "t:k:o:q:f:s:G:p:Tl:vVS:F0R:O:rwb:MgzP:Xa:L:I:D:JB:C:1Z:Nd:E")) != -1) {
    switch (opt) {
    case 'a':
      alignment = atoi(optarg) * 1024;
      alignment = (alignment >> 1) << 1;
      break;
    case 'd':
      description = strdup(optarg);
      fprintf(stderr,"*info* description: '%s'\n", description);
      break;
    case 'N':
      fsyncAfterWriting = 1;
      break;
    case 'J':
      dataLogFormat = JSON;
      break;
    case 'D':
      dataLog = strdup(optarg);
      break;
    case 'E':
      dontExitOnErrors = 1;
      break;
    case 'B':
      benchLog = strdup(optarg);
      break;
    case 'L':
      logPositions = strdup(optarg);
      break;
    case 'I':
      {}
      size_t added = loadDeviceDetails(optarg, &deviceList, &deviceCount);
      fprintf(stderr,"*info* added %zd devices from file '%s'\n", added, optarg);
      //      inputFilenames = strdup(optarg);
      break;
    case 'X':
      dontUseExclusive++;
      break;
    case 'P':
      maxPositions = atoi(optarg);
      if (verbose) {
	fprintf(stderr,"*info* hard coded maximum number of positions %zd\n", maxPositions);
      }
      break;
    case 'z':
      startAtZero = 0;
      break;
    case 'Z':
      startAtZero = atol(optarg);
      if (startAtZero < 0 && startAtZero != -99999) startAtZero = labs(startAtZero);
      break;
    case 'M':
      dataLogFormat = MYSQL;
      break;
    case 'T':
      table = 1;
      break;
    case 'O':
      if (!specifiedDevices) {
	specifiedDevices = strdup(optarg);
      }
      break;
    case '0':
      maxPositions = 0;
      break;
    case 'r':
      readRatio += 0.5;
{'fraction_non_alphanumeric': 0.1335866705641625, 'fraction_numerical': 0.028354282373574978, 'mean_word_length': 2.799555802332038, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '190542', 'n_tokens_mistral': 2668, 'n_tokens_neox': 2497, 'n_words': 669}