ns-3 Direct Code Execution
Home
Tutorials ▼
Docs ▼
Wiki
Manual
Develop ▼
API
Bugs
API
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
dce-debug.cc
Go to the documentation of this file.
1
#include "
utils.h
"
2
#include "
process.h
"
3
#include "
loader-factory.h
"
4
#include "
task-manager.h
"
5
#include "ns3/log.h"
6
#include "ns3/breakpoint.h"
7
#include <list>
8
#include <algorithm>
9
10
using namespace
ns3;
11
12
NS_LOG_COMPONENT_DEFINE
(
"SimuDebug"
);
13
14
static
std::list<uint32_t>
g_dce_debug_nodes
;
15
16
void
*
dce_debug_lookup
(
char
*str)
17
{
18
Thread
*current =
Current
();
19
if
(current == 0)
20
{
21
return
0;
22
}
23
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << str);
24
NS_ASSERT (current != 0);
25
return
current->
process
->
loader
->
Lookup
(current->
process
->
mainHandle
, str);
26
}
27
uint32_t
dce_debug_nodeid
(
void
)
28
{
29
NS_LOG_FUNCTION (
Current
() <<
UtilsGetNodeId
());
30
return
UtilsGetNodeId
();
31
}
32
const
char
*
dce_debug_processname
(
void
)
33
{
34
Thread
*current =
Current
();
35
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
());
36
NS_ASSERT (current != 0);
37
return
current->
process
->
name
.c_str ();
38
}
39
bool
dce_debug_is_node
(uint32_t node)
40
{
41
return
std::find (
g_dce_debug_nodes
.begin (),
42
g_dce_debug_nodes
.end (),
43
node) !=
g_dce_debug_nodes
.end ();
44
}
45
static
void
dce_debug_switch_notify
(
void
)
46
{
47
if
(
Current
() != 0
48
&&
dce_debug_is_node
(
dce_debug_nodeid
()))
49
{
50
NS_BREAKPOINT ();
51
}
52
}
53
void
dce_debug_monitor
(uint32_t node)
54
{
55
if
(
dce_debug_is_node
(node))
56
{
57
return
;
58
}
59
g_dce_debug_nodes
.push_back (node);
60
TaskManager::Current
()->
SetSwitchNotify
(
dce_debug_switch_notify
);
61
}
62
void
dce_debug_unmonitor
(uint32_t node)
63
{
64
g_dce_debug_nodes
.remove (node);
65
if
(
g_dce_debug_nodes
.empty ())
66
{
67
TaskManager::Current
()->
SetSwitchNotify
(0);
68
}
69
}
model
dce-debug.cc
Generated on Fri Aug 30 2013 13:57:55 for ns-3-dce by
1.8.1.2