Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xanadu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
SYNERG
xanadu
Commits
bb0a146c
Commit
bb0a146c
authored
Feb 21, 2020
by
Naman Dixit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearchitected resource daemon to be multithreaded for instrumentation
parent
b876af62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
resource_system/src/grunt/grunt.c
resource_system/src/grunt/grunt.c
+16
-1
No files found.
resource_system/src/grunt/grunt.c
View file @
bb0a146c
...
@@ -113,6 +113,9 @@ int main(int argc, char** argv)
...
@@ -113,6 +113,9 @@ int main(int argc, char** argv)
tmCommandInit
();
tmCommandInit
();
instrumentCommandInit
();
instrumentCommandInit
();
pthread_t
thread_manager
;
pthread_create
(
&
thread_manager
,
NULL
,
&
tmProcessLoop
,
NULL
);
Kafka
kafka
=
{
0
};
Kafka
kafka
=
{
0
};
kafka
.
writer
=
kafkaCreateWriter
(
&
kafka
,
"10.129.6.5:9092"
);
kafka
.
writer
=
kafkaCreateWriter
(
&
kafka
,
"10.129.6.5:9092"
);
...
@@ -219,8 +222,10 @@ int main(int argc, char** argv)
...
@@ -219,8 +222,10 @@ int main(int argc, char** argv)
// TODO(naman): Error
// TODO(naman): Error
}
else
{
}
else
{
Char
*
node_id
=
cJSON_GetObjectItem
(
root
,
"node_id"
)
->
valuestring
;
Char
*
node_id
=
cJSON_GetObjectItem
(
root
,
"node_id"
)
->
valuestring
;
if
(
streq
(
node_id
,
node_name
))
{
if
(
streq
ual
(
node_id
,
node_name
))
{
// FIXME(naman): Fix this placeholder
// FIXME(naman): Fix this placeholder
Thread_Manager_Command
tmc
=
{
0
};
tmCommandEnqueue
(
tmc
);
/* "resource_id": "logical-entity-id", */
/* "resource_id": "logical-entity-id", */
/* "function_id": "unique-function-id", */
/* "function_id": "unique-function-id", */
/* "timestamp" : "iso-8601-timestamp", */
/* "timestamp" : "iso-8601-timestamp", */
...
@@ -265,6 +270,16 @@ int main(int argc, char** argv)
...
@@ -265,6 +270,16 @@ int main(int argc, char** argv)
}
}
}
}
{
JSON_Print_Command
command
=
{
0
};
while
(
instrumentCommandDequeue
(
&
command
))
{
// TODO(naman): Enable this after proper testing
/* if (!kafkaWrite(kafka.writer, command.topic, "resource_daemon", command.msg)) { */
/* return -1; */
/* } */
}
}
{
// Send a heartbeat message if it is time to do so
{
// Send a heartbeat message if it is time to do so
U64
time_new
=
timeMilli
();
U64
time_new
=
timeMilli
();
U64
time_passed
=
time_new
-
time_begin
;
U64
time_passed
=
time_new
-
time_begin
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment