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. #ifndef _PVFMM_PROFILE_HPP_
  8. #define _PVFMM_PROFILE_HPP_
  9. #include <mpi.h>
  10. #include <iostream>
  11. #include <string>
  12. #include <vector>
  13. #include <stack>
  14. #include <pvfmm_common.hpp>
  15. #ifndef __PROFILE__
  16. #define __PROFILE__ -1
  17. #endif
  18. namespace pvfmm{
  19. class Profile{
  20. public:
  21. static void Add_FLOP(long long inc);
  22. static void Add_MEM(long long inc);
  23. static void Enable(bool state){enable_state=state;};
  24. static void Tic(const char* name_, const MPI_Comm* comm_=NULL,bool sync_=false, int level=0);
  25. static void Toc();
  26. static void print(const MPI_Comm* comm_=NULL);
  27. static void reset();
  28. private:
  29. static long long FLOP;
  30. static long long MEM;
  31. static bool enable_state;
  32. static std::stack<bool> sync;
  33. static std::stack<std::string> name;
  34. static std::stack<MPI_Comm*> comm;
  35. static std::vector<long long> max_mem;
  36. static unsigned int enable_depth;
  37. static std::stack<int> verb_level;
  38. static std::vector<bool> e_log;
  39. static std::vector<bool> s_log;
  40. static std::vector<std::string> n_log;
  41. static std::vector<double> t_log;
  42. static std::vector<long long> f_log;
  43. static std::vector<long long> m_log;
  44. static std::vector<long long> max_m_log;
  45. };
  46. }//end namespace
  47. #endif //_PVFMM_PROFILE_HPP_