SST/macro
units.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009-2010 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SPROCKIT_COMMON_UNITS_H_INCLUDED
13 #define SPROCKIT_COMMON_UNITS_H_INCLUDED
14 
15 #include <map>
16 #include <stdint.h>
17 
18 namespace sprockit {
19 
20 /// Multiply two 64 bit integer values and check for overflow.
21 /// This would be two lines if we had 128-bit integers.
22 int64_t
23 multiply64(int64_t a, int64_t b, bool &errorflag);
24 
25 void
26 populate_bandwidth_names(std::map<std::string, int64_t> &abbrname,
27  std::map<std::string, int64_t> &fullname);
28 
29 double
30 get_bandwidth(const char *value, bool &errorflag, bool print_errors = false);
31 
32 double
33 get_bandwidth(const char *value);
34 
35 double
36 get_frequency(const char* value, bool& errorflag, bool print_errors = false);
37 
38 long
39 byte_length(const char* value, bool& errorflag, bool print_errors = false);
40 
41 void
42 populate_timestamp_names(std::map<std::string, int64_t> &value);
43 
44 void
45 populate_frequency_names(std::map<std::string, int64_t> &value);
46 
47 /// Get a timestamp possiblly suffixed with any of the identifiers
48 /// psec, nsec, usec, msec, sec, ps, ns, us, ms, s
49 double
50 get_timestamp(const char *value, bool &errorflag, bool print_errors = false);
51 
52 }
53 
54 #endif
55 
long byte_length(const char *value, bool &errorflag, bool print_errors=false)
double get_timestamp(const char *value, bool &errorflag, bool print_errors=false)
Get a timestamp possiblly suffixed with any of the identifiers psec, nsec, usec, msec, sec, ps, ns, us, ms, s.
int64_t multiply64(int64_t a, int64_t b, bool &errorflag)
Multiply two 64 bit integer values and check for overflow.
void populate_timestamp_names(std::map< std::string, int64_t > &value)
double get_frequency(const char *value, bool &errorflag, bool print_errors=false)
void populate_frequency_names(std::map< std::string, int64_t > &value)
void populate_bandwidth_names(std::map< std::string, int64_t > &abbrname, std::map< std::string, int64_t > &fullname)
double get_bandwidth(const char *value, bool &errorflag, bool print_errors=false)