HPCToolkit
fnbounds_client.c File Reference
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <hpcfnbounds/syserv-mesg.h>
#include "client.h"
#include "disabled.h"
#include "fnbounds_file_header.h"
#include "messages.h"
#include "sample_sources_all.h"
#include "monitor.h"
Include dependency graph for fnbounds_client.c:

Go to the source code of this file.

Macros

#define SERVER_MEM_LIMIT   140
 
#define MIN_NUM_QUERIES   12
 
#define SUCCESS   0
 
#define FAILURE   -1
 
#define END_OF_FILE   -2
 

Enumerations

enum  { SYSERV_ACTIVE = 1, SYSERV_INACTIVE }
 

Functions

static int read_all (int fd, void *buf, size_t count)
 
static int write_all (int fd, const void *buf, size_t count)
 
static int read_mesg (struct syserv_mesg *mesg)
 
static int write_mesg (int32_t type, int64_t len)
 
static size_t page_align (size_t size)
 
static void * mmap_anon (size_t size)
 
static int hpcrun_sigpipe_handler (int sig, siginfo_t *info, void *context)
 
static void shutdown_server (void)
 
static int launch_server (void)
 
int hpcrun_syserv_init (void)
 
void hpcrun_syserv_fini (void)
 
void * hpcrun_syserv_query_specific (const char *fname, struct fnbounds_file_header *fh, int query)
 
void * hpcrun_syserv_query (const char *fname, struct fnbounds_file_header *fh)
 
void * hpcrun_syserv_query_var (const char *fname, struct fnbounds_file_header *fh)
 

Variables

static int client_status = SYSERV_INACTIVE
 
static char * server
 
static int fdout = -1
 
static int fdin = -1
 
static pid_t my_pid
 
static pid_t server_pid = 0
 
static long mem_limit = SERVER_MEM_LIMIT * 1024
 
static int num_queries = 0
 
static int mem_warning = 0
 
char ** environ
 

Macro Definition Documentation

◆ END_OF_FILE

#define END_OF_FILE   -2

Definition at line 138 of file fnbounds_client.c.

◆ FAILURE

#define FAILURE   -1

Definition at line 137 of file fnbounds_client.c.

◆ MIN_NUM_QUERIES

#define MIN_NUM_QUERIES   12

Definition at line 134 of file fnbounds_client.c.

◆ SERVER_MEM_LIMIT

#define SERVER_MEM_LIMIT   140

Definition at line 133 of file fnbounds_client.c.

◆ SUCCESS

#define SUCCESS   0

Definition at line 136 of file fnbounds_client.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SYSERV_ACTIVE 
SYSERV_INACTIVE 

Definition at line 140 of file fnbounds_client.c.

Function Documentation

◆ hpcrun_sigpipe_handler()

static int hpcrun_sigpipe_handler ( int  sig,
siginfo_t *  info,
void *  context 
)
static

Definition at line 304 of file fnbounds_client.c.

Here is the caller graph for this function:

◆ hpcrun_syserv_fini()

void hpcrun_syserv_fini ( void  )

Definition at line 490 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_syserv_init()

int hpcrun_syserv_init ( void  )

Definition at line 440 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_syserv_query()

void* hpcrun_syserv_query ( const char *  fname,
struct fnbounds_file_header fh 
)

Definition at line 625 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_syserv_query_specific()

void* hpcrun_syserv_query_specific ( const char *  fname,
struct fnbounds_file_header fh,
int  query 
)

Definition at line 511 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcrun_syserv_query_var()

void* hpcrun_syserv_query_var ( const char *  fname,
struct fnbounds_file_header fh 
)

Definition at line 631 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ launch_server()

static int launch_server ( void  )
static

Definition at line 343 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmap_anon()

static void* mmap_anon ( size_t  size)
static

Definition at line 280 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ page_align()

static size_t page_align ( size_t  size)
static

Definition at line 257 of file fnbounds_client.c.

Here is the caller graph for this function:

◆ read_all()

static int read_all ( int  fd,
void *  buf,
size_t  count 
)
static

Definition at line 170 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_mesg()

static int read_mesg ( struct syserv_mesg mesg)
static

Definition at line 221 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_server()

static void shutdown_server ( void  )
static

Definition at line 321 of file fnbounds_client.c.

Here is the caller graph for this function:

◆ write_all()

static int write_all ( int  fd,
const void *  buf,
size_t  count 
)
static

Definition at line 197 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_mesg()

static int write_mesg ( int32_t  type,
int64_t  len 
)
static

Definition at line 239 of file fnbounds_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ client_status

int client_status = SYSERV_INACTIVE
static

Definition at line 145 of file fnbounds_client.c.

◆ environ

char** environ

◆ fdin

int fdin = -1
static

Definition at line 149 of file fnbounds_client.c.

◆ fdout

int fdout = -1
static

Definition at line 148 of file fnbounds_client.c.

◆ mem_limit

long mem_limit = SERVER_MEM_LIMIT * 1024
static

Definition at line 155 of file fnbounds_client.c.

◆ mem_warning

int mem_warning = 0
static

Definition at line 157 of file fnbounds_client.c.

◆ my_pid

pid_t my_pid
static

Definition at line 151 of file fnbounds_client.c.

◆ num_queries

int num_queries = 0
static

Definition at line 156 of file fnbounds_client.c.

◆ server

char* server
static

Definition at line 146 of file fnbounds_client.c.

◆ server_pid

pid_t server_pid = 0
static

Definition at line 152 of file fnbounds_client.c.