The VisAO Camera
profiler.h
1 
2 
3 #ifndef __profiler_h__
4 #define __profiler_h__
5 
6 #include <string>
7 #include <cstring>
8 #include <iostream>
9 
10 
11 #include <pthread.h>
12 #include <signal.h>
13 
14 #include "profileutils.h"
15 
16 #include "visaoimutils.h" // for get_visao_filename
17 
18 ///The VisAO namespace
19 namespace VisAO
20 {
21 
22 class profiler
23 {
24  public:
25  profiler(int nlogs);
26 
27  ~profiler();
28 
29  pthread_mutex_t thmutex;
30  pthread_cond_t thcond;
31 
32  protected:
33  int numlogs;
34  int currlog;
35  int abscurrlog;
36 
37  seqlog * logs;
38 
39  std::string base_path;
40  char fnamebuff[22];
41  std::string curr_path;
42 
43  int fd; ///< file descriptor of the currently open file.
44 
45  int logs_per_file; ///< maximum number of logs to write per file.
46  int logs_in_file; ///< number of logs in current file.
47 
48  int last_written; ///< index of the last file written.
49  int abslast_written; ///< last file written
50 
51  pthread_mutex_t my_mutex;
52 
53  public:
54  int set_numlogs(int nlogs);
55  int get_numlogs(){return numlogs;}
56 
57  int get_currlog(){return currlog;}
58  int get_abscurrlog(){return abscurrlog;}
59 
60  seqlog * get_seqlog(){return logs;}
61 
62 
63  int set_base_path(const std::string& bp);
64  std::string get_base_path(){return base_path;}
65 
66  int get_nextlog(int clog);
67 
68  int logseqmsg(const char * sm, const char * sp, timespec *st);
69 
70  bool logs_to_write();
71 
72  int write_logs();
73 
74  void start();
75 
76 };// class profiler
77 
78 }//namespace VisAO
79 
80 #endif //__profiler_h__
81 
82 
int logs_per_file
maximum number of logs to write per file.
Definition: profiler.h:45
int abslast_written
last file written
Definition: profiler.h:49
int last_written
index of the last file written.
Definition: profiler.h:48
int logs_in_file
number of logs in current file.
Definition: profiler.h:46
The namespace of VisAO software.
Declarations for various image utility functions.
int fd
file descriptor of the currently open file.
Definition: profiler.h:43