[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] determining throughput

From: John M Daniel
Subject: [Discuss-gnuradio] determining throughput
Date: Wed, 22 Jun 2005 17:25:12 -0400


I am trying to determine what the throughput is with my
configuration. I am trying to accomplish this by inputting
a sinusoid and writing it to a file.  Having never dealt with 
binary files, I am now stuck on reading in values from this 
file to see if there are any discontinuities.  Below is my 
attempt at trying to read in the values (pretty much copied from the
gr_file_source.cc) which gives a segfault.  Once I can read in and
access the values I plan to check them for continuity in chunks. 
Pointers on whether or not this is the right approach or 
if there is a much simpler answer to my question would be 
greatly appreciated.  Thanks and let me know if there is any
information that would help you help me ; )

// trying to read values in from binary file
// and see if the values in the file are 
// continuos in order to determine the
// throughput of my setup

#include <iostream>
#include <fstream>
#include <vector>
#include <cstdio>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdexcept>

using namespace std;

bool continous() { return false; } //in progress

int main () {
        int fd;
        const char *filename = "output.data";
        void *  d_fp;
        if ((fd = open(filename, ios::binary | ios::ate)) < 0){
                perror (filename);
                throw std::runtime_error ("can't open file");
        if ((d_fp = fdopen(fd, "rb")) == NULL){
                perror (filename);
                throw std::runtime_error ("can't open file");

        vector<void *>  buffer;
        char *o = (char *) buffer[0];   
        int size = 100;
        int i;  

        while (size) {
                i = fread(o, 8, size, (FILE *) d_fp);
                //size -= i;
                size = 0;
                o += i * 8;

                if (size == 0)  // done

                if (i > 0)      // short read try again

        fclose ((FILE *) d_fp);
        return 0;

John Daniel
Virginia Tech

reply via email to

[Prev in Thread] Current Thread [Next in Thread]