summaryrefslogtreecommitdiff
path: root/TAO/utils/logWalker/Thread.h
blob: 844ab1ade4ace7c1132378cd3b9cb4a7f92a1724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// -*- C++ -*-

//

#ifndef LOG_WALKER_THREAD_H
#define LOG_WALKER_THREAD_H

#include "ace/SString.h"
#include "ace/Synch.h"
#include "ace/Containers.h"
#include "ace/Hash_Map_Manager.h"
#include "Invocation.h"
#include "PeerProcess.h"

typedef ACE_Unbounded_Stack<PeerProcess *> PeerProcessStack;
typedef ACE_Unbounded_Stack<Invocation *> InvocationStack;

class Thread
{
public:
  Thread (long tid, const char *alias, size_t offset);
  long max_depth (void) const;
  long client_encounters (void) const;
  long server_encounters (void) const;
  long id (void) const;
  const ACE_CString &alias (void) const;
  void incoming_from (PeerProcess *);
  void add_invocation (Invocation *);
  void push_invocation (Invocation *);
  void pop_invocation (void);
  Invocation *current_invocation (void) const;

  PeerProcess *incoming (void) const;
  void handle_request (void);
  void enter_wait (PeerProcess *);
  void exit_wait (PeerProcess *, size_t linenum);
  GIOP_Buffer *giop_target (void);
  void set_giop_target (GIOP_Buffer *buffer);
  void dump_detail (ostream &strm);
  void dump_invocations (ostream &strm);
  void dump_incidents (ostream &strm);

  void get_summary (long &sent_reqs, long &recv_reqs, size_t &sent_size, size_t &recv_size);

  void push_new_connection (PeerProcess *pp);
  PeerProcess *pop_new_connection (void);
  PeerProcess *peek_new_connection (void) const;

  void pending_local_addr (const ACE_CString &addr);
  const ACE_CString& pending_local_addr (void) const;
  void active_handle (long handle);
  long active_handle (void) const;
  void set_dup (Thread *other, bool set_other);
  void clear_dup (void);
  void swap_target (void);
  bool has_dup (void);

  size_t count_nesting (void);

private:
  long id_;
  ACE_CString alias_;
  size_t max_depth_;
  long client_encounters_;
  long server_encounters_;
  size_t nested_;
  PeerProcessStack pending_;
  PeerProcess *incoming_;
  PeerProcessStack new_connection_;
  ACE_CString pending_local_addr_;
  GIOP_Buffer *giop_target_;
  Thread *target_dup_;
  InvocationList invocations_;
  InvocationStack current_invocation_;
  long active_handle_;
  size_t first_line_;
};

#endif // LOG_WALKER_THREAD_H