libosmscout  1.1.1
ImportProgress.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_IMPORTPROGRESS_H
2 #define OSMSCOUT_IMPORTPROGRESS_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2020 Lukas Karas
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22 
26 
27 #include <osmscout/util/Progress.h>
29 
30 #include <map>
31 
32 namespace osmscout {
33 
35 {
36 public:
37  ImportProgress() = default;
38  virtual ~ImportProgress() = default;
39 
40  virtual void StartImport(const ImportParameter &param);
41  virtual void FinishedImport();
42 
43  void DumpModuleDescription(const ImportModuleDescription& description);
44 
45  virtual void StartModule(size_t currentStep, const ImportModuleDescription& moduleDescription);
46  virtual void FinishedModule();
47 };
48 
50 {
51 private:
52  struct ModuleStat {
53  ImportModuleDescription description;
54  std::chrono::steady_clock::duration duration;
55  double vmUsage;
56  double residentSet;
57  };
58 
59 public:
60  StatImportProgress() = default;
61  virtual ~StatImportProgress() = default;
62 
63  void StartImport(const ImportParameter &param) override;
64  void FinishedImport() override;
65 
66  void StartModule(size_t currentStep, const ImportModuleDescription& moduleDescription) override;
67  void FinishedModule() override;
68 
69  bool DumpDotStats(const std::string &filename);
70 
71 private:
72  StopClock timer;
73  StopClock overAllTimer;
74  MemoryMonitor monitor;
75  double maxVMUsage=0.0;
76  double maxResidentSet=0.0;
77  ImportModuleDescription currentModule;
78  std::list<ModuleStat> moduleStats;
79  std::string destinationDirectory;
80  std::map<std::string, osmscout::FileOffset> fileSizes;
81 };
82 
83 }
84 
85 #endif //OSMSCOUT_IMPORTPROGRESS_H
Definition: ImportProgress.h:49
Definition: ImportProgress.h:34
#define OSMSCOUT_IMPORT_API
Definition: ImportImportExport.h:45
Definition: Area.h:38
Definition: Progress.h:67