libsc
1.6.0
|
00001 /* 00002 This file is part of the SC Library. 00003 The SC Library provides support for parallel scientific applications. 00004 00005 Copyright (C) 2010 The University of Texas System 00006 00007 The SC Library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 The SC Library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with the SC Library; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 02110-1301, USA. 00021 */ 00022 00023 #ifndef SC_STATISTICS_H 00024 #define SC_STATISTICS_H 00025 00026 #include <sc.h> 00027 #include <sc_keyvalue.h> 00028 00029 SC_EXTERN_C_BEGIN; 00030 00031 /* sc_statinfo_t stores information for one random variable */ 00032 typedef struct sc_statinfo 00033 { 00034 int dirty; /* only update stats if this is true */ 00035 long count; /* inout, global count is 52bit accurate */ 00036 double sum_values, sum_squares, min, max; /* inout */ 00037 int min_at_rank, max_at_rank; /* out */ 00038 double average, variance, standev; /* out */ 00039 double variance_mean, standev_mean; /* out */ 00040 const char *variable; /* name of the variable for output */ 00041 } 00042 sc_statinfo_t; 00043 00044 /* sc_statistics_t allows dynamically adding random variables */ 00045 typedef struct sc_stats 00046 { 00047 sc_MPI_Comm mpicomm; 00048 sc_keyvalue_t *kv; 00049 sc_array_t *sarray; 00050 } 00051 sc_statistics_t; 00052 00056 void sc_stats_set1 (sc_statinfo_t * stats, 00057 double value, const char *variable); 00058 00064 void sc_stats_init (sc_statinfo_t * stats, 00065 const char *variable); 00066 00070 void sc_stats_accumulate (sc_statinfo_t * stats, double value); 00071 00093 void sc_stats_compute (sc_MPI_Comm mpicomm, int nvars, 00094 sc_statinfo_t * stats); 00095 00102 void sc_stats_compute1 (sc_MPI_Comm mpicomm, int nvars, 00103 sc_statinfo_t * stats); 00104 00115 void sc_stats_print (int package_id, int log_priority, 00116 int nvars, sc_statinfo_t * stats, 00117 int full, int summary); 00118 00121 sc_statistics_t *sc_statistics_new (sc_MPI_Comm mpicomm); 00122 void sc_statistics_destroy (sc_statistics_t * stats); 00123 00127 void sc_statistics_add (sc_statistics_t * stats, 00128 const char *name); 00129 00133 void sc_statistics_add_empty (sc_statistics_t * stats, 00134 const char *name); 00135 00140 void sc_statistics_set (sc_statistics_t * stats, 00141 const char *name, double value); 00142 00146 void sc_statistics_accumulate (sc_statistics_t * stats, 00147 const char *name, double value); 00148 00151 void sc_statistics_compute (sc_statistics_t * stats); 00152 00155 void sc_statistics_print (sc_statistics_t * stats, 00156 int package_id, int log_priority, 00157 int full, int summary); 00158 00159 SC_EXTERN_C_END; 00160 00161 #endif /* !SC_STATISTICS_H */