codes-darshan-io-wrkld.c 1.92 KB
Newer Older
1
2
3
4
5
6
7
/*
 * Copyright (C) 2013 University of Chicago.
 * See COPYRIGHT notice in top-level directory.
 *
 */

#include "codes/codes-workload.h"
8
#include "codes/quickhash.h"
9
#include "codes-workload-method.h"
10

11
#include "darshan-logutils.h"
12
13
14
15
16
17
18
19
20
21
22
23
24

/* CODES workload API functions for workloads generated from darshan logs*/
static int darshan_io_workload_load(const char *params, int rank);
static void darshan_io_workload_get_next(int rank, struct codes_workload_op *op);

/* workload method name and function pointers for the CODES workload API */
struct codes_workload_method darshan_io_workload_method =
{
    .method_name = "darshan_io_workload",
    .codes_workload_load = darshan_io_workload_load,
    .codes_workload_get_next = darshan_io_workload_get_next,
};

25
/* info about this darshan workload group needed by bgp model */
26
27
/* TODO: is this needed for darshan workloads? */
/* TODO: does this need to be stored in the rank context to support multiple workloads? */
28

29
30
31
32
/* hash table to store per-rank workload contexts */
//static struct qhash_table *rank_tbl = NULL;
//static int rank_tbl_pop = 0;

33
34
35
/* load the workload generator for this rank, given input params */
static int darshan_io_workload_load(const char *params, int rank)
{
36
37
    darshan_params *d_params = (darshan_params *)params;
    darshan_fd logfile_fd;
38

39
    if (!d_params)
40
41
        return -1;

42
43
    /* (re)seed the random number generator */
    srand(time(NULL));
44

45
46
    logfile_fd = darshan_log_open(d_params->log_file_path, "r");
    if (logfile_fd < 0)
47
        return -1;
48

49
    darshan_log_close(logfile_fd);
50
51
52
53
54
55
56
57
58
59
60

    return 0;
}

/* pull the next event (independent or collective) for this rank from its event context */
static void darshan_io_workload_get_next(int rank, struct codes_workload_op *op)
{

    return;
}

61
62
63
/* return the workload info needed by the bgp model */
/* TODO: do we really need this? */
static void *darshan_io_workload_get_info(int rank)
64
{
65
    return &(darshan_workload_info);
66
}