profile.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * \file profile.hpp
  3. * \author Dhairya Malhotra, dhairya.malhotra@gmail.com
  4. * \date 2-11-2011
  5. * \brief This file contains definition of the class Profile.
  6. */
  7. #include <mpi.h>
  8. #include <string>
  9. #include <vector>
  10. #include <stack>
  11. #include <pvfmm_common.hpp>
  12. #ifndef _PVFMM_PROFILE_HPP_
  13. #define _PVFMM_PROFILE_HPP_
  14. #ifndef __PROFILE__
  15. #define __PROFILE__ -1
  16. #endif
  17. namespace pvfmm{
  18. class Profile{
  19. public:
  20. static void Add_FLOP(long long inc);
  21. static void Add_MEM(long long inc);
  22. static void Enable(bool state){enable_state=state;};
  23. static void Tic(const char* name_, const MPI_Comm* comm_=NULL,bool sync_=false, int level=0);
  24. static void Toc();
  25. static void print(const MPI_Comm* comm_=NULL);
  26. static void reset();
  27. private:
  28. static long long FLOP;
  29. static long long MEM;
  30. static bool enable_state;
  31. static std::stack<bool> sync;
  32. static std::stack<std::string> name;
  33. static std::stack<MPI_Comm*> comm;
  34. static std::vector<long long> max_mem;
  35. static unsigned int enable_depth;
  36. static std::stack<int> verb_level;
  37. static std::vector<bool> e_log;
  38. static std::vector<bool> s_log;
  39. static std::vector<std::string> n_log;
  40. static std::vector<double> t_log;
  41. static std::vector<long long> f_log;
  42. static std::vector<long long> m_log;
  43. static std::vector<long long> max_m_log;
  44. };
  45. }//end namespace
  46. #endif //_PVFMM_PROFILE_HPP_