Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

histhandler.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2002 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021  
00022 #ifndef __AWHANDLER_HIST__
00023 #define __AWHANDLER_HIST__
00024 
00025 #include <stdio.h>
00026 
00027 #include "monitor.h"
00028 
00030 /*\@{*/
00031 
00078 /* 
00079 Changes:
00080 
00081 */
00082 
00086 typedef enum {
00087 
00088   AW_HIST_RESET_ON_COPY = 0x1 /* reset hist after copy cmd */
00089 
00090 } aw_hist_flag_t;
00091 
00095 typedef struct {
00096 
00097    aw_event_sig_t
00098     datapt,                   /* event->id for incoming data events */
00099     copy_cmd,                 /* event->id for incoming copy cmd events */
00100     reset_cmd;                /* event->id for incoming reset cmd events */
00101 
00102 } aw_hist_in_events_t;
00103 
00107 typedef struct {
00108 
00109    aw_event_sig_t
00110     copy;                     /* event->id for generated copy events */
00111 
00112 } aw_hist_out_events_t;
00113 
00117 typedef struct {
00118 
00119   /* events I am processing */
00120   aw_hist_in_events_t
00121    in;
00122 
00123   /* events I am generating */
00124   aw_hist_out_events_t
00125    out;
00126 
00127 } aw_hist_events_t;
00128 
00132 typedef struct {
00133 
00134    u_int32_t
00135     counter,
00136     nbins,
00137    *bins;
00138 
00139   /* input values */
00140   float64_t
00141    max,min,binwidth;
00142 
00143   /* calculated values */
00144   float64_t
00145    min_sample,max_sample,sum_sample;
00146 
00147 } aw_hist_data_t;
00148 
00149 
00153 typedef struct {
00154 
00155   aw_handler_t
00156    handler_header;
00157 
00158   /* events I am processing/generating */
00159   aw_hist_events_t
00160    events;
00161 
00162   aw_hist_flag_t
00163    flags;
00164 
00165   aw_hist_data_t
00166    data;
00167 
00168 } aw_histhandler_t;
00169 
00170 
00176 aw_hist_data_t *aw_copy_hist_data(aw_hist_data_t *data);
00177 
00182 void aw_destroy_hist_data(aw_hist_data_t *data);
00183 
00193 void aw_writehist(aw_hist_data_t *hist_data, FILE *outstream);
00194 
00195 
00209 aw_histhandler_t *aw_create_histhandler( float64_t min,
00210                                          float64_t max,
00211                                          u_int32_t nbins,
00212                                          aw_hist_flag_t flags,
00213                                          aw_hist_events_t *events,
00214                                          int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00215                                          int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00216                                          const aw_alarm_sched_t *sched,
00217                                          aw_logger_t *logger);
00218 
00219 
00224 void aw_free_histhandler(aw_histhandler_t *h);
00225 
00226 /*\@}*/
00227 
00228 #endif
00229 
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)