1 #ifndef BACKEND_H__ 2 #define BACKEND_H__ 1 3 4 #include "driver.h" 5 #include "typedefs.h" 6 #include "main.h" /* max_time */ 7 8 /* --- Types --- */ 9 10 /* struct statistic_s: Aggregate data for statistics. 11 * 12 * In particular the structures is used with update_statistic() in order 13 * to calculate a weighted average of the last period of time. 14 */ 15 16 struct statistic_s 17 { 18 mp_int last_time; /* Time of last weighted-average calculation. */ 19 long sum; /* Sum since last weighted-average calculation. */ 20 double weighted_avg; /* The current weighted average. */ 21 }; 22 23 /* --- Variables --- */ 24 25 extern mp_int current_time; 26 extern Bool time_to_call_heart_beat; 27 extern volatile Bool comm_time_to_call_heart_beat; 28 extern uint32 total_player_commands; 29 extern volatile mp_int total_alarms; 30 extern uint num_listed_objs; 31 extern uint num_last_processed; 32 extern uint num_last_data_cleaned; 33 extern statistic_t stat_last_processed; 34 extern statistic_t stat_last_data_cleaned; 35 extern statistic_t stat_in_list; 36 37 extern Bool extra_jobs_to_do; 38 39 typedef enum { gcDont = 0, gcMalloc, gcEfun } GC_Request; 40 extern GC_Request gc_request; 41 extern statistic_t stat_load; 42 extern statistic_t stat_compile; 43 44 extern Bool mud_is_up; 45 46 /* --- Prototypes --- */ 47 48 extern void clear_state (void); 49 extern void check_alarm (void); 50 extern void install_signal_handlers(); 51 extern void backend (void); 52 extern void preload_objects (int eflag); 53 extern svalue_t *f_debug_message (svalue_t *sp); 54 ALARM_HANDLER_PROT(catch_alarm); 55 extern void update_statistic (statistic_t * pStat, long number); 56 extern void update_statistic_avg (statistic_t * pStat, long number); 57 extern double relate_statistics (statistic_t sStat, statistic_t sRef); 58 extern void update_compile_av (int lines); 59 extern svalue_t *v_garbage_collection(svalue_t *sp, int num_arg); 60 extern svalue_t *f_query_load_average(svalue_t *sp); 61 62 /* --- Macros --- */ 63 64 #endif /* BACKEND_H__ */ 65