Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
emper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informatik 4 (Systemsoftware)
manycore
emper
Commits
482e41e4
"public/init.te" did not exist on "6cb2c893b12db00c73009f6ab1f6c69426b0cc05"
Commit
482e41e4
authored
7 years ago
by
Florian Schmaus
Browse files
Options
Downloads
Patches
Plain Diff
Add DIE_MSG_ERRNO() macro
parent
f6184112
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
emper/Common.cpp
+7
-2
7 additions, 2 deletions
emper/Common.cpp
emper/Common.hpp
+4
-3
4 additions, 3 deletions
emper/Common.hpp
emper/Runtime.cpp
+8
-8
8 additions, 8 deletions
emper/Runtime.cpp
with
19 additions
and
13 deletions
emper/Common.cpp
+
7
−
2
View file @
482e41e4
#include
<stdio.h>
#include
<cstdlib>
#include
<iostream>
#include
<cstdio>
#include
"Common.hpp"
void
die
(
const
char
*
message
)
{
std
::
cout
<<
message
<<
std
::
endl
;
void
die
(
const
char
*
message
,
bool
usePerror
)
{
if
(
usePerror
)
{
std
::
perror
(
message
);
}
else
{
std
::
cout
<<
message
<<
std
::
endl
;
}
exit
(
EXIT_FAILURE
);
}
This diff is collapsed.
Click to expand it.
emper/Common.hpp
+
4
−
3
View file @
482e41e4
...
...
@@ -8,14 +8,15 @@ typedef std::function<void(void)> func_t;
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define DIE die(__FILE__ ":" TOSTRING(__LINE__))
#define DIE_MSG(x) die(__FILE__ ":" TOSTRING(__LINE__) "-" #x)
#define DIE die(__FILE__ ":" TOSTRING(__LINE__), false)
#define DIE_MSG(x) die(__FILE__ ":" TOSTRING(__LINE__) "-" #x, false)
#define DIE_MSG_ERRNO(x) die(__FILE__ ":" TOSTRING(__LINE__) "-" #x, true)
#define likely(x) __builtin_expect(!!(x),1)
#define unlikely(x) __builtin_expect(!!(x),0)
#define ALIGN_TO_CACHE_LINE alignas(64)
void
die
(
const
char
*
message
);
void
die
(
const
char
*
message
,
bool
usePerror
);
typedef
unsigned
int
WORD
;
This diff is collapsed.
Click to expand it.
emper/Runtime.cpp
+
8
−
8
View file @
482e41e4
...
...
@@ -52,7 +52,7 @@ Runtime::Runtime(workerid_t workerCount, RuntimeStrategy& strategy) : workerCoun
CPU_SET
(
i
%
nprocs
,
&
cpuset
);
errno
=
pthread_attr_setaffinity_np
(
&
attr
,
sizeof
(
cpuset
),
&
cpuset
);
if
(
errno
)
DIE_MSG
(
"pthread_attr_setaffinity_np() failed"
);
if
(
errno
)
DIE_MSG
_ERRNO
(
"pthread_attr_setaffinity_np() failed"
);
// End non portable.
// Load the worker ID into the worker ID map.
...
...
@@ -60,16 +60,16 @@ Runtime::Runtime(workerid_t workerCount, RuntimeStrategy& strategy) : workerCoun
auto
thread_function
=
[](
void
*
voidWorkerId
)
->
void
*
{
return
currentRuntime
->
workerLoop
(
voidWorkerId
);
};
errno
=
pthread_create
(
&
threads
[
i
],
&
attr
,
thread_function
,
&
workerIds
[
i
]);
if
(
errno
)
DIE_MSG
(
"pthread_create() failed"
);
if
(
errno
)
DIE_MSG
_ERRNO
(
"pthread_create() failed"
);
}
}
Runtime
::~
Runtime
()
{
DBG
(
"Runtime "
<<
this
<<
" is terminating"
);
for
(
workerid_t
i
=
0
;
i
<
workerCount
;
++
i
)
{
int
res
=
pthread_cancel
(
threads
[
i
]);
if
(
res
)
{
DIE_MSG
(
"pthread_cancel() failed"
);
errno
=
pthread_cancel
(
threads
[
i
]);
if
(
errno
)
{
DIE_MSG
_ERRNO
(
"pthread_cancel() failed"
);
}
}
{
...
...
@@ -84,9 +84,9 @@ void* Runtime::workerLoop(void* voidWorkerId) {
LOGD
(
"Worker loop started by thread "
<<
syscall
(
SYS_gettid
));
int
oldType
;
int
res
=
pthread_setcanceltype
(
PTHREAD_CANCEL_ASYNCHRONOUS
,
&
oldType
);
if
(
res
)
{
DIE_MSG
(
"pthread_setcanceltype() failed"
);
errno
=
pthread_setcanceltype
(
PTHREAD_CANCEL_ASYNCHRONOUS
,
&
oldType
);
if
(
errno
)
{
DIE_MSG
_ERRNO
(
"pthread_setcanceltype() failed"
);
}
// Initialze the workers PRNG seed.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment