コード例 #1
0
ファイル: alacrity.c プロジェクト: ncsu-samatova/ALACRITY
// Opens a FILE pointer for input and an ALFileStore for output. Also returns the length of the input file
int encodeCommandOpenFiles(int argc, char **argv, FILE **infile, uint64_t *infile_len, ALStore *outfile) {
    if (argc != 2) usage_and_exit();

    const char *infilename = argv[0];
    const char *outbasename = argv[1];

    struct stat st;
    _Bool infile_exists = (stat(infilename, &st) == 0);
    if (!infile_exists) {
        fprintf(stderr, "Error: encoder cannot find input file %s\n", infilename);
        return 1;
    }

    *infile_len = st.st_size;

    *infile = fopen(infilename, "r");
    if (*infile == NULL) {
        fprintf(stderr, "Error: encoder cannot open input file %s\n", infilename);
        return 1;
    }

//    printf(" Using legacy format %s \n", OPTIONS.legacy_format?"y":"n");
    ALStoreOpenPOSIX(outfile, outbasename, "w", OPTIONS.legacy_format);

    return 0;
}
コード例 #2
0
ファイル: alacrity.c プロジェクト: ncsu-samatova/ALACRITY
// Opens an ALFileStore for input
int commandOpenFiles(int argc, char **argv, ALStore *infile) {
    if (argc != 1) usage_and_exit();

    const char *inbasename = argv[0];

    ALError err = ALStoreOpenPOSIX(infile, inbasename, "r", OPTIONS.legacy_format);
    if (err != ALErrorNone) {
        fprintf(stderr, "Error: decoder cannot open input files with basename %s\n", inbasename);
        return 1;
    }

    return 0;
}
コード例 #3
0
ファイル: alacrity.c プロジェクト: ncsu-samatova/ALACRITY
// Opens a FILE pointer for output and an ALFileStore for input
int decodeCommandOpenFiles(int argc, char **argv, ALStore *infile, FILE **outfile) {
    if (argc != 2) usage_and_exit();

    const char *inbasename = argv[0];
    const char *outfilename = argv[1];

//    printf("Using legacy format? %s \n", OPTIONS.legacy_format?"y":"n");
    ALError err = ALStoreOpenPOSIX(infile, inbasename, "r", OPTIONS.legacy_format);
    if (err != ALErrorNone) {
        fprintf(stderr, "Error: decoder cannot open input files with basename %s\n", inbasename);
        return 1;
    }

    *outfile = fopen(outfilename, "w");
    if (*outfile == NULL) {
        fprintf(stderr, "Error: decoder cannot open output file %s\n", outfilename);
        return 1;
    }

    return 0;
}
コード例 #4
0
int main(int argc, char **argv) {
	 if (argc < 4 || argc > 5) {
        fprintf(stderr, "Usage: %s <input path & base name>  <low val> <high val> [<use CII? default false>]\n", argv[0]);
        return 1;
    }
    int i = 1;
    const char *infilename = argv[i++];
//    const char *outfilenamebase = argv[2];
    double lval = atof(argv[i++]);
    double uval = atof(argv[i++]);
    _Bool useCII = argc >= 5 ? atoi(argv[i++]) > 0 : false;

    ALStore store;
    ALStoreOpenPOSIX(&store,infilename , "r", USE_LEGACY_FORMAT);

    ALGlobalMetadata gmeta;

    ALStoreGetGlobalMetadata(&store, &gmeta);

//    printf("number of partition %llu \n", gmeta.num_partitions);

    ALQueryEngine qe;
    ALQueryEngineInit(&qe, &store, true);

    printf("Performing query for values in range %lf to %lf...\n", lval, uval);

    ALUnivariateQuery uniquery;
    ALUnivariateQueryResult result;
    double s_time , e_time;
    ALQueryEngineStartUnivariateDoubleQuery(&qe, lval, uval, VALUE_RETRIEVAL_QUERY_TYPE, &uniquery);
    s_time = dclock1();
    while (ALQueryNextResult(&uniquery, &result)) {
//        printf("Read %llu results\n", result.resultCount);
        ALQueryResultDestroy(&result);
    }
	e_time = dclock1();
    ALStoreClose(&store);
	printf("Uniquery time performance %f \n ", e_time - s_time);
    return 0;
}