Exemple #1
0
//------------------------------------------------------------------------------
void SaveFile( const char *pszFN, const char* pszToSave )
{
  FILE *pFOut;

  pFOut = fopen( pszFN, "wt" );
  if ( pFOut == nullptr )
    throw generic_error(generic_error::GENERIC, "");
  if ( fputs( pszToSave, pFOut ) < 0 ) {
    fclose( pFOut );
    throw generic_error(generic_error::GENERIC, "");
  }
  fclose( pFOut );
}
Exemple #2
0
void list_functions(int * idx, int argc, char ** argv)
{
    switch(argv[*idx][2])
    {
        case '\0':
        case ' ':
        case 'i':
            if (*idx + 1 >= argc)
            {
                print_available_counters();
                print_available_rapl();
                return;
            }
            type2_list(idx, argc, argv);            
            break;
        case 'a':
            print_available_counters();
            print_available_rapl();
            break;
        case 'r':
            print_available_rapl();
            break;
        case 'c':
            print_available_counters();
            break;
        default:
            generic_error(*idx, argv);
    }
}
Exemple #3
0
//------------------------------------------------------------------------------
std::vector<Column::Ptr> Table::getColumnsByName( std::vector<Column::Ptr>& columns ) const
{
	std::vector<Column::Ptr> correspondingColumns;
	for( size_t idx = 0; idx < columns.size(); ++idx )
	{
		bool found = false;
		for( size_t idx2 = 0; idx2 < this->Columns.size(); ++idx2 )
			if( columns[idx]->getName() == this->Columns[idx2]->getName() )
			{
				correspondingColumns.push_back( this->Columns[idx2] );
				found = true;
				break;
			}
		if( !found )
		{
			//we have an intermediary column, not a table column
			//check that it's valid
			if( this->Columns.size() > 0 )
				if( columns[idx]->Items.size() != this->Columns[0]->Items.size() )
					throw generic_error(generic_error::INVALID_QUERY, "");
			correspondingColumns.push_back( columns[idx] );
		}
	}
	return correspondingColumns;
}
Exemple #4
0
/* Glue */
static void
f_smtp_version(INT32 args)
{
    char   buf[256];
    
    if (args != 0)
        generic_error("version", Pike_sp-args, args,
                      "Too many arguments. None required.\n");

    if (!smtp_version(buf, sizeof(buf), 0))
        generic_error("version", Pike_sp, args,
                      "libesmtp: 'smtp_version' returned 'buffer too small' - "
                      "please report it to [email protected]\n");

    pop_n_elems(args);
    push_string(make_shared_string(buf));
}
Exemple #5
0
void type2_set(int * idx, int argc, char ** argv)
{
    int socket = 0;
    int numsockets = num_sockets();
    struct rapl_power_info raplinfo;
    struct rapl_limit socketlim, socketlim2, dramlim;
    socketlim.bits = 0;
    socketlim.watts = 0;
    socketlim.seconds = 0;
    socketlim2.bits = 0;
    socketlim2.watts = 0;
    socketlim2.seconds = 0;
    switch (argv[++*idx][0])
    {
        case 'd':
            set_to_defaults();            
            break;
        case 'm':
            // set a memory limit
            set_mem_limit(idx, argc, argv);
            break;
        default:
            // -s socket watts seconds
            //fprintf(stdout, "%s\n", argv[i]);
            if (*idx >= argc)
            {
                generic_error(*idx, argv);
            }
            if (argc - *idx < 5)
            {
                fprintf(stderr, "Error: invalid number of parameters for power limit\n");
                generic_error(*idx, argv);
            }
            socket = atoi(argv[*idx]);
            socketlim.watts = strtod(argv[++*idx], NULL);
            socketlim.seconds = strtod(argv[++*idx], NULL);
            if (ISVERBOSE) fprintf(stdout, "Socket %d\n", socket);
            if (ISVERBOSE) dump_rapl_limit(&socketlim, stdout);
            socketlim2.watts = strtod(argv[++*idx], NULL);
            socketlim2.seconds = strtod(argv[++*idx], NULL);
            if (ISVERBOSE) dump_rapl_limit(&socketlim2, stdout);
            set_pkg_rapl_limit(socket, &socketlim, &socketlim2);
            break;
    }
}
Exemple #6
0
static void
f_smtp_errno(INT32 args)
{
    if (args != 0)
        generic_error("errno", Pike_sp-args, args,
                      "Too many arguments. None required.\n");

    pop_n_elems(args);
    push_int(smtp_errno());
}
Exemple #7
0
//------------------------------------------------------------------------------
void Table::dumpRaw( std::ostream& os )
{
  if( this->Columns.size() == 0 )
    throw generic_error(generic_error::INVALID_TABLE, "");
  size_t nrColumns = this->Columns.size();
  if( this->HasCount )
    --nrColumns;
  os << "\"" << this->getOriginalName() << "\" " << this->ID << " " << this->TotalCount << " " << nrColumns << std::endl;
  for (auto& col : Columns)
  {
    col->dumpRaw(os);
  }
  os << std::endl;
}
Exemple #8
0
void type2_print(int * idx, int argc, char ** argv)
{
    switch  (argv[++*idx][0])
    {
        case 'r':        
            get_rapl_stuff();            
            break;
        case 'i':
            dump_rapl_power_info(stdout);
            break;
        default:
            generic_error(*idx, argv);
    }
}
Exemple #9
0
static void
f_smtp_create_session(INT32 args)
{
    if (args != 0)
        generic_error("create_session", Pike_sp-args, args,
                      "Too many arguments. None required.\n");

    if (!THIS->sessions) {
        THIS->nsessions = 0;
        THIS->sessionsize = 1;
        THIS->sessions = (smtp_session_t*)malloc(sizeof(smtp_session_t));
        if (!THIS->sessions)
            generic_error("create_session", Pike_sp-args, args,
                          "Failed to allocate memory for session storage.\n");
    } else {
        THIS->sessionsize <<= TABLE_GROWTH_FACTOR;
        THIS->sessions = (smtp_session_t*)realloc(THIS->sessions, THIS->sessionsize);
        if (!THIS->sessions) {
            THIS->sessionsize >>= TABLE_GROWTH_FACTOR;
            generic_error("create_session", Pike_sp-args, args,
                          "Failed to reallocate memory for session storage.\n");
        }
    }
Exemple #10
0
//------------------------------------------------------------------------------
void Table::dumpXml( std::ostream& os )
{
  if( this->Columns.size() == 0 )
    throw generic_error(generic_error::INVALID_TABLE, "");
  size_t nrColumns = this->Columns.size();
  os << "<Table Name=\"" << this->getOriginalName() << "\" ID=\"" << this->ID << "\" NbRows=\"" << this->TotalCount << "\">" << std::endl;
  os << "<Columns>" << std::endl;
  for (auto& col : Columns)
  {
    col->dumpXml(os);
  }
  os << "</Columns>" << std::endl;
  os << "</Table>" << std::endl;
}
Exemple #11
0
void set_functions(int * idx, int argc, char ** argv)
{
    switch (argv[*idx][2])
    {
        case '\0':
        case ' ':
        case 'e':
            if (*idx + 1 >= argc)
            {
                generic_error(*idx, argv);
                return;
            }
            type2_set(idx, argc, argv);
            break;
        case 'm':
            set_mem_limit(idx, argc, argv);
            break;
        case 'd':
            set_to_defaults();
            break;
        default:
            generic_error(*idx, argv);
    }
}
Exemple #12
0
void printing_functions(int * idx, int argc, char ** argv)
{
    uint64_t * rapl_flags = NULL;
    struct rapl_data * rd = NULL, *r1 = NULL, *r2 = NULL;
    switch(argv[*idx][2])
    {
        rapl_init(&rd, &rapl_flags);
        case '\0':
            if (*idx >= argc)
            {
                generic_error(*idx, argv);
            }
            type2_print(idx, argc, argv);
            break;
        case 'r':
            get_rapl_stuff();
            break;
        case 'i':
            dump_rapl_power_info(stdout);
            break;
        default:
            generic_error(*idx, argv);
    }
}
Exemple #13
0
void set_mem_limit(int * idx, int argc, char ** argv)
{
    struct rapl_limit dramlim; 
    int socket = 0;
    int numsockets = num_sockets();
    if (argc - *idx < 2)
    {
        fprintf(stderr, "Error: invalid number of parameters for dram power limit\n");
        generic_error(*idx, argv);
    }
    dramlim.bits = 0;
    dramlim.watts = 0;
    dramlim.seconds = 0;
    socket = atoi(argv[++*idx]);
    dramlim.watts = strtod(argv[++*idx], NULL);
    dramlim.seconds = strtod(argv[++*idx], NULL);
    if (ISVERBOSE) dump_rapl_limit(&dramlim, stdout);
    set_dram_rapl_limit(socket, &dramlim);
}
Exemple #14
0
static void
f_smtp_strerror(INT32 args)
{
    int    err;
    char   buf[512], *str;
    
    if (args != 1)
        generic_error("strerror", Pike_sp-args, args,
                      "Incorrect number of parameters - required 1.\n");

    get_all_args("strerror", args, "%i", &err);
    pop_n_elems(args);
    
    str = smtp_strerror(err, buf, sizeof(buf));
    if (!str)
        push_string(make_shared_string("Unknown error code."));
    else
        push_string(make_shared_string(str));
}
Exemple #15
0
void type2_list(int * idx, int argc, char ** argv)
{
    switch(argv[++*idx][0])
    {
        case 'a':
            // print everything available
            print_available_counters();
            print_available_rapl();
            break;
        case 'r':
            //print available rapl stuff
            print_available_rapl();
            break;
        case 'c':
            // print available counter stuff
            print_available_counters();
            break;
        default:
            generic_error(*idx, argv);
    }
}
Exemple #16
0
//-------------------------------------------------------------------------------
ColumnItem::Ptr getMinMaxFromThesaurus(	size_t tableID, size_t colIdx, size_t partIdx, bool min, Base& BaseDesc, Settings& Settings )
{
	ColumnItem::Ptr minMax = NULL;
  size_t tableIdx = 0;
  for (tableIdx = 0; tableIdx < BaseDesc.getTables().size(); ++tableIdx)
  {
    if (BaseDesc.getTables()[tableIdx]->ID == tableID)
      break;
  }
	std::string fileName = getThesaurusFileName( Settings.dataPath.c_str(), tableIdx + 1, colIdx + 1, partIdx );
	FILE* pFIn = fopen( fileName.c_str(), "rb" );
	if ( pFIn == NULL )
		return minMax;
	FileCloser fileCloser(pFIn);
	Column::Ptr column = BaseDesc.getTable(static_cast<unsigned int>(tableID))->Columns[colIdx];

	size_t binItemSize	= 0;
	size_t tmpBufSize = 1000;
	switch( column->Type )
	{
	case COL_TYPE_INT: 
		binItemSize = 4;
		break;
	case COL_TYPE_BIG_INT:
	case COL_TYPE_DATE:
	case COL_TYPE_DOUBLE:
		binItemSize = 8;
		break;
	case COL_TYPE_VARCHAR:
		binItemSize = column->Size;
		tmpBufSize = column->Size + 1000;
		break;
	default:
		throw generic_error(generic_error::NOT_IMPLEMENTED, "type not supported");
	}

	unsigned char *pTmpBuf = new unsigned char[tmpBufSize];
	boost::scoped_array<unsigned char> pTmpBufDel( pTmpBuf );
	if( !min )
	{
		//get the file size
		if( fseek( pFIn, 0, SEEK_END ) != 0 )
			assert( 0 );
		long fileSize = ftell( pFIn );
		if( fileSize == -1 )
			assert( 0 );
		if( fseek( pFIn, fileSize - static_cast<long>(binItemSize), SEEK_SET ) != 0 )
			assert( 0 );
	}
	if( fread( pTmpBuf, 1, binItemSize, pFIn ) != binItemSize )
		throw generic_error(generic_error::INVALID_FILE, "invalid thesaurus file [%s]", fileName.c_str());

	switch( column->Type )
	{
	case COL_TYPE_INT: 
		{
			int *pItemData = (int*)( pTmpBuf );
			minMax = new ColumnItem( *pItemData );
		}
		break;
	case COL_TYPE_BIG_INT:
	case COL_TYPE_DATE:
		{
			llong *pItemData = (llong*)( pTmpBuf );
			minMax = new ColumnItem( (double) *pItemData );
		}
		break;
	case COL_TYPE_DOUBLE:
		{
			double *pItemData = (double*)( pTmpBuf );
			minMax = new ColumnItem( *pItemData );
		}
		break;
	case COL_TYPE_VARCHAR:
		pTmpBuf[column->Size] = '\0';
		minMax = new ColumnItem( (char*) pTmpBuf );
		break;
	}

	return minMax;
}
Exemple #17
0
static void
decode(VMPM *vmpm)
{
  Arithcoder *ac;
  Arithmodel *am;
  Arithmodel *bin_am;
  unsigned int *index_to_symbol;
  int i, n;
  unsigned int j;

  //debug_message_fn("()\n");
  fatal("DECODING IS INVALID. NEED REIMPLEMENTATION.\n");

  ac = arithcoder_arith_create();
  am = arithmodel_order_zero_create();

  arithcoder_decode_init(ac, vmpm->infile);
  arithmodel_decode_init(am, ac);

  bin_am = arithmodel_order_zero_create();
  arithmodel_decode_init(bin_am, ac);
  arithmodel_install_symbol(bin_am, 1);
  arithmodel_install_symbol(bin_am, 1);

  vmpm->token_index[vmpm->I] = vmpm->blocksize / ipow(vmpm->r, vmpm->I);
  for (i = vmpm->I; i >= 1; i--) {
    stat_message(vmpm, "Level %d: %d\n", i, vmpm->token_index[i]);
    vmpm->token_index[i - 1] = 0;
    if ((vmpm->tokens[i] = calloc(vmpm->token_index[i], sizeof(Token))) == NULL)
      memory_error(NULL, MEMORY_ERROR);
    /* newtoken[] will not be known by decoder without sending. */
    //arithmodel_order_zero_reset(am, 1, vmpm->newtoken[i]);
    arithmodel_order_zero_reset(am, 1, vmpm->token_index[i] >> 2);
    for (j = 0; j < vmpm->token_index[i]; j++) {
      Index idx;

      arithmodel_decode(am, &idx);
      vmpm->tokens[i][j].value++;
      if (vmpm->tokens[i][j].value > vmpm->token_index[i - 1]) {
	if (vmpm->tokens[i][j].value == vmpm->token_index[i - 1] + 1)
	  vmpm->token_index[i - 1]++;
	else
	  generic_error((char *)"Invalid token value.\n", INVALID_TOKEN_VALUE_ERROR);
      }
    }
    vmpm->token_index[i - 1] *= vmpm->r;
  }

  if ((index_to_symbol = calloc(vmpm->alphabetsize, sizeof(unsigned int))) == NULL)
    memory_error(NULL, MEMORY_ERROR);

  n = 0;
  stat_message(vmpm, "Level 0: %d\n", vmpm->token_index[0]);
  for (j = 0; j < vmpm->token_index[0]; j++) {
    Index v;

    if (arithmodel_decode(am, &v) == 2) {
      arithmodel_decode_bits(bin_am, &vmpm->tokens[0][j].value, vmpm->bits_per_symbol, 0, 1);
      index_to_symbol[n++] = vmpm->tokens[0][j].value;
    } else {
      vmpm->tokens[0][j].value = index_to_symbol[v];
    }
  }
  free(index_to_symbol);

  arithcoder_decode_final(ac);

  arithmodel_destroy(am);
  arithcoder_destroy(ac);
}
Exemple #18
0
static void
encode(VMPM *vmpm)
{
  Arithcoder *ac;
  Arithmodel *char_am;
  Arithmodel *am;
  Arithmodel *bin_am;
  unsigned int j, nsymbols, *symbol_to_index;
  int i, match_found;

  //debug_message_fn("()\n");

  if (!vmpm->outfile) {
    debug_message_fnc("outfile is NULL.\n");
    return;
  }

  ac = arithcoder_arith_create();
  arithcoder_encode_init(ac, vmpm->outfile);

  char_am = arithmodel_order_zero_create();
  arithmodel_encode_init(char_am, ac);
  arithmodel_order_zero_set_update_escape_freq(char_am, update_escape_freq);

  am = arithmodel_order_zero_create();
  arithmodel_encode_init(am, ac);

  bin_am = arithmodel_order_zero_create();
  arithmodel_encode_init(bin_am, ac);

  match_found = 0;
  for (i = vmpm->I; i >= 1; i--) {
    nsymbols = 0;
    for (j = 0; j < vmpm->token_index[i]; j++) {
      Token_value tv = vmpm->token[i][j]->value - 1;

      if (nsymbols == tv) {
	nsymbols++;
      } else {
	match_found++;
	break;
      }
    }
    if (match_found) {
      stat_message(vmpm, "Match found at Level %d\n", i);
      break;
    }
  }

  fputc(i, vmpm->outfile);
  if (match_found) {
    for (; i >= 1; i--) {
      stat_message(vmpm, "Level %d (%d tokens, %d distinct): ", i, vmpm->token_index[i], vmpm->newtoken[i] - 1);
      arithmodel_order_zero_reset(bin_am, 0, 0);
      arithmodel_install_symbol(bin_am, 1);
      arithmodel_install_symbol(bin_am, 1);
      /* The first token of each level must be t_0. */
      if (vmpm->token[i][0]->value != 1)
	generic_error((char *)"Invalid token value.\n", INVALID_TOKEN_VALUE_ERROR);
      /* Hence, we don't need to encode it. */
      stat_message(vmpm, "e ");
      nsymbols = 1;
      arithmodel_order_zero_reset(am, 0, 0);
      arithmodel_install_symbol(am, 1);
      for (j = 1; j < vmpm->token_index[i]; j++) {
	Token_value tv = vmpm->token[i][j]->value - 1;

	if (nsymbols == tv) {
	  stat_message(vmpm, "e ");
	  nsymbols++;
	  arithmodel_encode(bin_am, 1);
	  arithmodel_install_symbol(am, 1);
	} else {
	  stat_message(vmpm, "%d ", tv);
	  arithmodel_encode(bin_am, 0);
	  arithmodel_encode(am, tv);
	}
      }
      stat_message(vmpm, "\n");
      stat_message(vmpm, "Level %d: %ld bytes\n", i, ftell(vmpm->outfile));
    }
  }

  if ((symbol_to_index = malloc(vmpm->alphabetsize * sizeof(unsigned int))) == NULL)
    memory_error(NULL, MEMORY_ERROR);
  memset(symbol_to_index, 255, vmpm->alphabetsize * sizeof(unsigned int));

  nsymbols = 0;
  arithmodel_order_zero_reset(bin_am, 0, 0);
  arithmodel_install_symbol(bin_am, 1);
  arithmodel_install_symbol(bin_am, 1);
  arithmodel_order_zero_reset(char_am, 0, vmpm->alphabetsize - 1);
  stat_message(vmpm, "Level 0 (%d tokens): ", vmpm->token_index[0]);
  for (j = 0; j < vmpm->token_index[0]; j++) {
    if (symbol_to_index[(int)vmpm->token[0][j]] == (unsigned int)-1) {
      stat_message(vmpm, "e ");
      arithmodel_encode(char_am, nsymbols);
      symbol_to_index[(int)vmpm->token[0][j]] = nsymbols++;
      arithmodel_encode_bits(bin_am, (int)vmpm->token[0][j], vmpm->bits_per_symbol, 0, 1);
    } else {
      stat_message(vmpm, "%d ", symbol_to_index[(int)vmpm->token[0][j]]);
      arithmodel_encode(char_am, symbol_to_index[(int)vmpm->token[0][j]]);
    }
  }
  stat_message(vmpm, "\n");
  free(symbol_to_index);

  arithmodel_encode_final(bin_am);
  arithmodel_encode_final(char_am);
  arithcoder_encode_final(ac);

  arithmodel_destroy(bin_am);
  arithmodel_destroy(char_am);
  arithcoder_destroy(ac);
}
Exemple #19
0
static void
decode(VMPM *vmpm)
{
  Arithcoder *ac;
  Arithmodel *am;
  Arithmodel *bin_am;
  unsigned int *index_to_symbol;
  int i, n;
  unsigned int j;

  //debug_message_fn("()\n");

  ac = arithcoder_arith_create();
  arithcoder_decode_init(ac, vmpm->infile);

  am = arithmodel_order_zero_create();
  arithmodel_decode_init(am, ac);

  bin_am = arithmodel_order_zero_create();
  arithmodel_decode_init(bin_am, ac);

  i = fgetc(vmpm->outfile);
  vmpm->token_index[i] = vmpm->blocksize / ipow(vmpm->r, i);
  for (; i >= 1; i--) {
    unsigned int tmp;

    arithmodel_order_zero_reset(bin_am, 0, 0);
    arithmodel_install_symbol(bin_am, 1);
    arithmodel_install_symbol(bin_am, 1);
    arithmodel_decode_cbt(bin_am, &tmp, vmpm->token_index[i], 0, 1);
    vmpm->newtoken[i] = tmp + 1;
    stat_message(vmpm, "D:Level %d (%d tokens, %d distinct): ", i, vmpm->token_index[i], vmpm->newtoken[i] - 1);
    vmpm->token_index[i - 1] = 0;
    if ((vmpm->tokens[i] = calloc(vmpm->token_index[i], sizeof(Token))) == NULL)
      memory_error(NULL, MEMORY_ERROR);
    arithmodel_order_zero_reset(am, 0, vmpm->newtoken[i]);
    vmpm->tokens[i][0].value = 1;
    for (j = 1; j < vmpm->token_index[i]; j++) {
      Index idx;

      arithmodel_decode(am, &idx);
      vmpm->tokens[i][j].value = idx + 1;
      if (vmpm->tokens[i][j].value > vmpm->token_index[i - 1]) {
	if (vmpm->tokens[i][j].value == vmpm->token_index[i - 1] + 1) {
	  stat_message(vmpm, "e ");
	  vmpm->token_index[i - 1]++;
	} else
	  generic_error((char *)"Invalid token value.\n", INVALID_TOKEN_VALUE_ERROR);
      } else {
	stat_message(vmpm, "%d ", idx);
      }
    }
    vmpm->token_index[i - 1] *= vmpm->r;
    stat_message(vmpm, "\n");
  }

  if ((index_to_symbol = calloc(vmpm->alphabetsize, sizeof(unsigned int))) == NULL)
    memory_error(NULL, MEMORY_ERROR);

  n = 0;
  arithmodel_order_zero_reset(am, 0, vmpm->alphabetsize - 1);
  arithmodel_order_zero_reset(bin_am, 0, 0);
  arithmodel_install_symbol(bin_am, 1);
  arithmodel_install_symbol(bin_am, 1);
  stat_message(vmpm, "D:Level 0 (%d tokens): ", vmpm->token_index[0]);
  for (j = 0; j < vmpm->token_index[0]; j++) {
    Index v;

    if (arithmodel_decode(am, &v) == 2) {
      stat_message(vmpm, "e ");
      arithmodel_decode_bits(bin_am, &vmpm->tokens[0][j].value, vmpm->bits_per_symbol, 0, 1);
      index_to_symbol[n++] = vmpm->tokens[0][j].value;
    } else {
      vmpm->tokens[0][j].value = index_to_symbol[v];
      stat_message(vmpm, "%d ", v);
    }
  }
  stat_message(vmpm, "\n");
  free(index_to_symbol);

  arithcoder_decode_final(ac);

  arithmodel_destroy(bin_am);
  arithmodel_destroy(am);
  arithcoder_destroy(ac);
}
Exemple #20
0
int main(int argc, char ** argv)
{
    short israpl = 0;
    char next = '\0';
    ISVERBOSE = 0;
    init_msr();
    uint64_t msr_data;
    uint64_t msr;
    unsigned thread;
    int i;
    for (i = 0; i < argc; i++)
    {
        if (argv[i][0] == '-')
        {
            switch(argv[i][1])
            {
                case 'v':
                    // do verbose stuff
                    ISVERBOSE = 1;
                    break;
                case 'r':
                    // read an msr
                    if (argc - i < 3)
                    {
                        fprintf(stderr, "Error: not enough parameters to read flag\n");
                        generic_error(i, argv);
                    }
                    thread = atoi(argv[++i]);
                    msr = strtol(argv[++i], NULL, 16);
                    read_msr_by_idx(thread, msr, &msr_data);
                    fprintf(stdout, "%lx\n", msr_data);
                    break;
                case 'w':
                    // write an msr
                    if (argc - i < 4)
                    {
                        fprintf(stderr, "Error: not enough parameters to write flag\n");
                        generic_error(i, argv);
                    }
                    thread = atoi(argv[++i]);
                    msr = strtol(argv[++i], NULL, 16);
                    msr_data = strtol(argv[++i], NULL, 16);
                    write_msr_by_idx(thread, msr, msr_data);
                    break;
                case 'i':
                    // do interactive stuff
                    fprintf(stdout, "Interactive mode is not yet available\n");
                    break;
                case '-':
                    // go deeper down the rabbit hole
                    switch(argv[i][2])
                    {
                        case 'h':
                            // print help stuff
                            help_stuff();
                            break;
                    }
                    return 0;
                case 'p':
                    // print out stuff
                    printing_functions(&i, argc, argv);
                    break;
                case 's':
                    // set a socket limit or set to default
                    set_functions(&i, argc, argv);
                    break;
                case 'l':
                    // list available events
                    list_functions(&i, argc, argv);
                    
                    return 0;
            }
        }
    }
 //   if (israpl)
 //   {
//        do_rapl_stuff(isverbose);
 //   }
    return 0;
}