Loading [MathJax]/extensions/tex2jax.js
PISM, A Parallel Ice Sheet Model 2.2.2-d6b3a29ca committed by Constantine Khrulev on 2025-03-28
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Profiling.hh
Go to the documentation of this file.
1/* Copyright (C) 2015 PISM Authors
2 *
3 * This file is part of PISM.
4 *
5 * PISM is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with PISM; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef PISM_PROFILING_HH
21#define PISM_PROFILING_HH
22
23#include <map>
24#include <string>
25#include <petsclog.h>
26
27namespace pism {
28
29class Profiling {
30public:
31 Profiling();
32 void start() const;
33 void report(const std::string &filename) const;
34 void begin(const char *name) const;
35 void end(const char *name) const;
36 void stage_begin(const char *name) const;
37 void stage_end(const char *name) const;
38private:
39 PetscClassId m_classid;
40 mutable std::map<std::string, PetscLogEvent> m_events;
41 mutable std::map<std::string, PetscLogStage> m_stages;
42};
43
44} // end of namespace pism
45
46#endif /* PISM_PROFILING_HH */
void begin(const char *name) const
Definition Profiling.cc:75
std::map< std::string, PetscLogEvent > m_events
Definition Profiling.hh:40
void report(const std::string &filename) const
Save detailed profiling data to a Python script.
Definition Profiling.cc:45
void end(const char *name) const
Definition Profiling.cc:91
void start() const
Enable PETSc logging.
Definition Profiling.cc:36
void stage_end(const char *name) const
Definition Profiling.cc:119
PetscClassId m_classid
Definition Profiling.hh:39
void stage_begin(const char *name) const
Definition Profiling.cc:103
std::map< std::string, PetscLogStage > m_stages
Definition Profiling.hh:41