Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
tapasco
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
52
Issues
52
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tapasco
tapasco
Commits
44a6271c
Commit
44a6271c
authored
Jul 14, 2017
by
Jens Korinth
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix most whitespace errors
parent
1914aec8
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
161 additions
and
161 deletions
+161
-161
arch/common/include/tapasco.hpp
arch/common/include/tapasco.hpp
+4
-4
arch/common/src/tapasco_functions.c
arch/common/src/tapasco_functions.c
+1
-1
arch/common/tests/tapasco-logging-benchmark/tapasco_logging_benchmark.c
...sts/tapasco-logging-benchmark/tapasco_logging_benchmark.c
+1
-1
arch/common/tests/tapasco_functions_test.c
arch/common/tests/tapasco_functions_test.c
+1
-1
common/src/gen_queue.c
common/src/gen_queue.c
+2
-2
examples/arrayinit/arrayinit-example-mt-ff.cc
examples/arrayinit/arrayinit-example-mt-ff.cc
+1
-1
examples/arrayinit/arrayinit-example-mt.c
examples/arrayinit/arrayinit-example-mt.c
+3
-3
examples/arraysum/arraysum-example-mt-ff.cc
examples/arraysum/arraysum-example-mt-ff.cc
+1
-1
examples/warraw/warraw-example-mt-ff.cc
examples/warraw/warraw-example-mt-ff.cc
+2
-2
examples/warraw/warraw-example-mt.c
examples/warraw/warraw-example-mt.c
+5
-5
kernel/sudoku/src/multithreaded.cpp
kernel/sudoku/src/multithreaded.cpp
+1
-1
kernel/warraw/warraw-tb.c
kernel/warraw/warraw-tb.c
+1
-1
platform/tests/iplatform.c
platform/tests/iplatform.c
+1
-1
platform/tests/platform_slots.c
platform/tests/platform_slots.c
+2
-2
platform/tests/platform_stress_alloc.c
platform/tests/platform_stress_alloc.c
+2
-2
platform/vc709/src/buddy_allocator/buddy_allocator.cpp
platform/vc709/src/buddy_allocator/buddy_allocator.cpp
+57
-57
platform/vc709/src/buddy_allocator/buddy_allocator.hpp
platform/vc709/src/buddy_allocator/buddy_allocator.hpp
+5
-5
platform/vc709/src/buddy_allocator/buddy_tree.cpp
platform/vc709/src/buddy_allocator/buddy_tree.cpp
+40
-40
platform/vc709/src/buddy_allocator/buddy_tree.hpp
platform/vc709/src/buddy_allocator/buddy_tree.hpp
+11
-11
platform/zynq/module/tests/stress-alloc.c
platform/zynq/module/tests/stress-alloc.c
+1
-1
platform/zynq/module/tests/stress-ioctl.c
platform/zynq/module/tests/stress-ioctl.c
+1
-1
platform/zynq/module/zynq_device.c
platform/zynq/module/zynq_device.c
+1
-1
src/main/scala/tapasco/dse/Alternatives.scala
src/main/scala/tapasco/dse/Alternatives.scala
+1
-1
src/test/scala/tapasco/base/ArchitectureTest.scala
src/test/scala/tapasco/base/ArchitectureTest.scala
+2
-2
src/test/scala/tapasco/base/BenchmarkTest.scala
src/test/scala/tapasco/base/BenchmarkTest.scala
+2
-2
src/test/scala/tapasco/base/ConfigurationTest.scala
src/test/scala/tapasco/base/ConfigurationTest.scala
+2
-2
src/test/scala/tapasco/base/CoreTest.scala
src/test/scala/tapasco/base/CoreTest.scala
+2
-2
src/test/scala/tapasco/base/KernelTest.scala
src/test/scala/tapasco/base/KernelTest.scala
+2
-2
src/test/scala/tapasco/base/PlatformTest.scala
src/test/scala/tapasco/base/PlatformTest.scala
+2
-2
src/test/scala/tapasco/filemgmt/BasePathManagerTest.scala
src/test/scala/tapasco/filemgmt/BasePathManagerTest.scala
+1
-1
src/test/scala/tapasco/parser/FeatureParsersSpec.scala
src/test/scala/tapasco/parser/FeatureParsersSpec.scala
+1
-1
src/test/scala/tapasco/reports/TimingReportTest.scala
src/test/scala/tapasco/reports/TimingReportTest.scala
+2
-2
No files found.
arch/common/include/tapasco.hpp
View file @
44a6271c
...
@@ -193,7 +193,7 @@ struct Tapasco {
...
@@ -193,7 +193,7 @@ struct Tapasco {
tapasco_device_release_job_id
(
dev_ctx
,
j_id
);
tapasco_device_release_job_id
(
dev_ctx
,
j_id
);
return
res
;
return
res
;
}
}
/**
/**
* Launches a job on the device and returns a future to the result.
* Launches a job on the device and returns a future to the result.
* @param f_id Kernel ID.
* @param f_id Kernel ID.
...
@@ -206,7 +206,7 @@ struct Tapasco {
...
@@ -206,7 +206,7 @@ struct Tapasco {
{
{
return
async
(
std
::
launch
::
async
,
[
=
,
&
ret
]{
return
launch
(
f_id
,
ret
,
args
...);
});
return
async
(
std
::
launch
::
async
,
[
=
,
&
ret
]{
return
launch
(
f_id
,
ret
,
args
...);
});
}
}
/**
/**
* Launches a job on the device without return value.
* Launches a job on the device without return value.
* @param f_id Kernel ID.
* @param f_id Kernel ID.
...
@@ -428,7 +428,7 @@ private:
...
@@ -428,7 +428,7 @@ private:
tapasco_device_free
(
dev_ctx
,
h
,
TAPASCO_DEVICE_ALLOC_FLAGS_NONE
);
tapasco_device_free
(
dev_ctx
,
h
,
TAPASCO_DEVICE_ALLOC_FLAGS_NONE
);
return
TAPASCO_SUCCESS
;
return
TAPASCO_SUCCESS
;
}
}
/** Gets a single const pointer argument (dealloc only). **/
/** Gets a single const pointer argument (dealloc only). **/
template
<
typename
T
>
template
<
typename
T
>
tapasco_res_t
get_args
(
tapasco_job_id_t
const
j_id
,
uint32_t
const
arg_idx
,
T
const
*
t
)
const
noexcept
tapasco_res_t
get_args
(
tapasco_job_id_t
const
j_id
,
uint32_t
const
arg_idx
,
T
const
*
t
)
const
noexcept
...
@@ -474,7 +474,7 @@ private:
...
@@ -474,7 +474,7 @@ private:
return
get_args
(
j_id
,
arg_idx
+
1
,
args
...);
return
get_args
(
j_id
,
arg_idx
+
1
,
args
...);
}
}
#endif
#endif
bool
_ok
{
false
};
bool
_ok
{
false
};
tapasco_ctx_t
*
ctx
{
nullptr
};
tapasco_ctx_t
*
ctx
{
nullptr
};
tapasco_dev_ctx_t
*
dev_ctx
{
nullptr
};
tapasco_dev_ctx_t
*
dev_ctx
{
nullptr
};
...
...
arch/common/src/tapasco_functions.c
View file @
44a6271c
...
@@ -114,7 +114,7 @@ void tapasco_functions_setup_system(tapasco_dev_ctx_t *dev_ctx, tapasco_function
...
@@ -114,7 +114,7 @@ void tapasco_functions_setup_system(tapasco_dev_ctx_t *dev_ctx, tapasco_function
++
funcs
;
++
funcs
;
++
slot_id
;
++
slot_id
;
}
}
}
}
inline
static
int
reserve_func
(
tapasco_func_t
*
f
,
tapasco_func_id_t
const
f_id
)
{
inline
static
int
reserve_func
(
tapasco_func_t
*
f
,
tapasco_func_id_t
const
f_id
)
{
...
...
arch/common/tests/tapasco-logging-benchmark/tapasco_logging_benchmark.c
View file @
44a6271c
...
@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
...
@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
printf
(
"Average throughput: %10.1f logs/s
\n
"
,
logs
/
(
time_diff
/
1000000
.
0
));
printf
(
"Average throughput: %10.1f logs/s
\n
"
,
logs
/
(
time_diff
/
1000000
.
0
));
printf
(
"Thread throughput: %10.1f logs/s
\n
"
,
printf
(
"Thread throughput: %10.1f logs/s
\n
"
,
logs
/
(
time_diff
/
1000000
.
0
)
/
(
double
)
thrdcnt
);
logs
/
(
time_diff
/
1000000
.
0
)
/
(
double
)
thrdcnt
);
free
(
_rnd_data
);
free
(
_rnd_data
);
printf
(
"Finished the test.
\n
"
);
printf
(
"Finished the test.
\n
"
);
tapasco_logging_exit
();
tapasco_logging_exit
();
...
...
arch/common/tests/tapasco_functions_test.c
View file @
44a6271c
...
@@ -56,7 +56,7 @@ START_TEST (tapasco_functions_check_counts)
...
@@ -56,7 +56,7 @@ START_TEST (tapasco_functions_check_counts)
fail_if
(
unavail
>=
0
);
fail_if
(
unavail
>=
0
);
tapasco_functions_release
(
funcs
,
slot_id
);
tapasco_functions_release
(
funcs
,
slot_id
);
}
}
tapasco_functions_deinit
(
funcs
);
tapasco_functions_deinit
(
funcs
);
}
}
END_TEST
END_TEST
...
...
common/src/gen_queue.c
View file @
44a6271c
...
@@ -98,7 +98,7 @@ void gq_enqueue(struct gq_t *q, void *v)
...
@@ -98,7 +98,7 @@ void gq_enqueue(struct gq_t *q, void *v)
atomic_compare_exchange_strong
(
&
q
->
tail
,
&
tail
,
new
);
atomic_compare_exchange_strong
(
&
q
->
tail
,
&
tail
,
new
);
}
}
}
}
}
}
TAGGED_PTR
(
n
)
=
{
.
ptr
=
nd
,
.
tag
=
tail
.
tag
+
1
};
TAGGED_PTR
(
n
)
=
{
.
ptr
=
nd
,
.
tag
=
tail
.
tag
+
1
};
atomic_compare_exchange_strong
(
&
q
->
tail
,
&
tail
,
n
);
atomic_compare_exchange_strong
(
&
q
->
tail
,
&
tail
,
n
);
...
@@ -131,7 +131,7 @@ void *gq_dequeue(struct gq_t *q)
...
@@ -131,7 +131,7 @@ void *gq_dequeue(struct gq_t *q)
TAGGED_PTR
(
new
)
=
{
.
ptr
=
next
.
ptr
,
head
.
tag
+
1
};
TAGGED_PTR
(
new
)
=
{
.
ptr
=
next
.
ptr
,
head
.
tag
+
1
};
if
(
atomic_compare_exchange_strong
(
&
q
->
head
,
&
head
,
new
))
if
(
atomic_compare_exchange_strong
(
&
q
->
head
,
&
head
,
new
))
break
;
break
;
}
}
}
}
}
}
...
...
examples/arrayinit/arrayinit-example-mt-ff.cc
View file @
44a6271c
...
@@ -151,7 +151,7 @@ int main(int argc, char **argv)
...
@@ -151,7 +151,7 @@ int main(int argc, char **argv)
std
::
vector
<
ff_node
*>
f
;
std
::
vector
<
ff_node
*>
f
;
for
(
int
i
=
0
;
i
<
sysconf
(
_SC_NPROCESSORS_CONF
);
++
i
)
for
(
int
i
=
0
;
i
<
sysconf
(
_SC_NPROCESSORS_CONF
);
++
i
)
f
.
push_back
(
new
Worker
);
f
.
push_back
(
new
Worker
);
Emitter
e
;
Emitter
e
;
Collector
c
;
Collector
c
;
ff_farm
<>
farm
(
f
,
&
e
,
&
c
);
ff_farm
<>
farm
(
f
,
&
e
,
&
c
);
...
...
examples/arrayinit/arrayinit-example-mt.c
View file @
44a6271c
...
@@ -81,17 +81,17 @@ static void *runTest(void *p)
...
@@ -81,17 +81,17 @@ static void *runTest(void *p)
// allocate mem on device and copy array part
// allocate mem on device and copy array part
tapasco_handle_t
h
=
tapasco_device_alloc
(
dev
,
SZ
*
sizeof
(
int
),
0
);
tapasco_handle_t
h
=
tapasco_device_alloc
(
dev
,
SZ
*
sizeof
(
int
),
0
);
check
(
h
!=
0
);
check
(
h
!=
0
);
// get a job id and set argument to handle
// get a job id and set argument to handle
tapasco_job_id_t
j_id
=
tapasco_device_acquire_job_id
(
dev
,
11
,
tapasco_job_id_t
j_id
=
tapasco_device_acquire_job_id
(
dev
,
11
,
TAPASCO_ACQUIRE_JOB_ID_BLOCKING
);
TAPASCO_ACQUIRE_JOB_ID_BLOCKING
);
printf
(
"run %ld: j_id = %d
\n
"
,
run
,
j_id
);
printf
(
"run %ld: j_id = %d
\n
"
,
run
,
j_id
);
check
(
j_id
>
0
);
check
(
j_id
>
0
);
check_tapasco
(
tapasco_device_job_set_arg
(
dev
,
j_id
,
0
,
sizeof
(
h
),
&
h
));
check_tapasco
(
tapasco_device_job_set_arg
(
dev
,
j_id
,
0
,
sizeof
(
h
),
&
h
));
// shoot me to the moon!
// shoot me to the moon!
check_tapasco
(
tapasco_device_job_launch
(
dev
,
j_id
,
TAPASCO_JOB_LAUNCH_BLOCKING
));
check_tapasco
(
tapasco_device_job_launch
(
dev
,
j_id
,
TAPASCO_JOB_LAUNCH_BLOCKING
));
// get the result
// get the result
check_tapasco
(
tapasco_device_copy_from
(
dev
,
h
,
&
arr
[
SZ
*
run
],
check_tapasco
(
tapasco_device_copy_from
(
dev
,
h
,
&
arr
[
SZ
*
run
],
SZ
*
sizeof
(
int
),
TAPASCO_COPY_BLOCKING
));
SZ
*
sizeof
(
int
),
TAPASCO_COPY_BLOCKING
));
...
...
examples/arraysum/arraysum-example-mt-ff.cc
View file @
44a6271c
...
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
...
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
std
::
vector
<
ff_node
*>
f
;
std
::
vector
<
ff_node
*>
f
;
for
(
int
i
=
0
;
i
<
sysconf
(
_SC_NPROCESSORS_CONF
);
++
i
)
for
(
int
i
=
0
;
i
<
sysconf
(
_SC_NPROCESSORS_CONF
);
++
i
)
f
.
push_back
(
new
Worker
);
f
.
push_back
(
new
Worker
);
Emitter
e
;
Emitter
e
;
Collector
c
;
Collector
c
;
ff_farm
<>
farm
(
f
,
&
e
,
&
c
);
ff_farm
<>
farm
(
f
,
&
e
,
&
c
);
...
...
examples/warraw/warraw-example-mt-ff.cc
View file @
44a6271c
...
@@ -156,7 +156,7 @@ int main(int argc, char **argv)
...
@@ -156,7 +156,7 @@ int main(int argc, char **argv)
arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
check
(
arr
!=
NULL
);
check
(
arr
!=
NULL
);
init_array
(
arr
,
SZ
*
RUNS
);
init_array
(
arr
,
SZ
*
RUNS
);
golden_arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
golden_arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
check
(
golden_arr
!=
NULL
);
check
(
golden_arr
!=
NULL
);
init_array
(
golden_arr
,
SZ
*
RUNS
);
init_array
(
golden_arr
,
SZ
*
RUNS
);
...
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
...
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
std
::
vector
<
ff_node
*>
f
;
std
::
vector
<
ff_node
*>
f
;
for
(
int
i
=
0
;
i
<
sysconf
(
_SC_NPROCESSORS_CONF
);
++
i
)
for
(
int
i
=
0
;
i
<
sysconf
(
_SC_NPROCESSORS_CONF
);
++
i
)
f
.
push_back
(
new
Worker
);
f
.
push_back
(
new
Worker
);
Emitter
e
;
Emitter
e
;
Collector
c
;
Collector
c
;
ff_farm
<>
farm
(
f
,
&
e
,
&
c
);
ff_farm
<>
farm
(
f
,
&
e
,
&
c
);
...
...
examples/warraw/warraw-example-mt.c
View file @
44a6271c
...
@@ -81,23 +81,23 @@ static void *runTest(void *p) {
...
@@ -81,23 +81,23 @@ static void *runTest(void *p) {
// golden run
// golden run
int
golden
=
warraw
(
&
golden_arr
[
SZ
*
run
]);
int
golden
=
warraw
(
&
golden_arr
[
SZ
*
run
]);
printf
(
"Golden output for run %ld: %d
\n
"
,
run
,
golden
);
printf
(
"Golden output for run %ld: %d
\n
"
,
run
,
golden
);
// allocate mem on device and copy array part
// allocate mem on device and copy array part
tapasco_handle_t
h
=
tapasco_device_alloc
(
dev
,
SZ
*
sizeof
(
int
),
0
);
tapasco_handle_t
h
=
tapasco_device_alloc
(
dev
,
SZ
*
sizeof
(
int
),
0
);
check
(
h
!=
0
);
check
(
h
!=
0
);
check_tapasco
(
tapasco_device_copy_to
(
dev
,
&
arr
[
SZ
*
run
],
h
,
check_tapasco
(
tapasco_device_copy_to
(
dev
,
&
arr
[
SZ
*
run
],
h
,
SZ
*
sizeof
(
int
),
TAPASCO_COPY_BLOCKING
));
SZ
*
sizeof
(
int
),
TAPASCO_COPY_BLOCKING
));
// get a job id and set argument to handle
// get a job id and set argument to handle
tapasco_job_id_t
j_id
=
tapasco_device_acquire_job_id
(
dev
,
12
,
tapasco_job_id_t
j_id
=
tapasco_device_acquire_job_id
(
dev
,
12
,
TAPASCO_ACQUIRE_JOB_ID_BLOCKING
);
TAPASCO_ACQUIRE_JOB_ID_BLOCKING
);
printf
(
"run %ld: j_id = %d
\n
"
,
run
,
j_id
);
printf
(
"run %ld: j_id = %d
\n
"
,
run
,
j_id
);
check
(
j_id
>
0
);
check
(
j_id
>
0
);
check_tapasco
(
tapasco_device_job_set_arg
(
dev
,
j_id
,
0
,
sizeof
(
h
),
&
h
));
check_tapasco
(
tapasco_device_job_set_arg
(
dev
,
j_id
,
0
,
sizeof
(
h
),
&
h
));
// shoot me to the moon!
// shoot me to the moon!
check_tapasco
(
tapasco_device_job_launch
(
dev
,
j_id
,
TAPASCO_JOB_LAUNCH_BLOCKING
));
check_tapasco
(
tapasco_device_job_launch
(
dev
,
j_id
,
TAPASCO_JOB_LAUNCH_BLOCKING
));
// get the result
// get the result
int32_t
r
=
0
;
int32_t
r
=
0
;
check_tapasco
(
tapasco_device_job_get_return
(
dev
,
j_id
,
sizeof
(
r
),
&
r
));
check_tapasco
(
tapasco_device_job_get_return
(
dev
,
j_id
,
sizeof
(
r
),
&
r
));
...
@@ -127,7 +127,7 @@ int main(int argc, char **argv) {
...
@@ -127,7 +127,7 @@ int main(int argc, char **argv) {
arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
check
(
arr
!=
NULL
);
check
(
arr
!=
NULL
);
init_array
(
arr
,
SZ
*
RUNS
);
init_array
(
arr
,
SZ
*
RUNS
);
golden_arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
golden_arr
=
(
int
*
)
malloc
(
SZ
*
RUNS
*
sizeof
(
int
));
check
(
golden_arr
!=
NULL
);
check
(
golden_arr
!=
NULL
);
init_array
(
golden_arr
,
SZ
*
RUNS
);
init_array
(
golden_arr
,
SZ
*
RUNS
);
...
...
kernel/sudoku/src/multithreaded.cpp
View file @
44a6271c
...
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
...
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
long
thrdcnt
{
sysconf
(
_SC_NPROCESSORS_CONF
)};
long
thrdcnt
{
sysconf
(
_SC_NPROCESSORS_CONF
)};
int
c
{
2
};
int
c
{
2
};
int
const
mode
{
argc
>
2
&&
argv
[
1
][
0
]
==
'f'
};
int
const
mode
{
argc
>
2
&&
argv
[
1
][
0
]
==
'f'
};
if
(
argc
<
3
)
{
if
(
argc
<
3
)
{
cerr
<<
"Usage: sudoku_mt <cpu|fgpa> [<number of threads>] <filename1> <filename2> ..."
<<
endl
;
cerr
<<
"Usage: sudoku_mt <cpu|fgpa> [<number of threads>] <filename1> <filename2> ..."
<<
endl
;
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
...
kernel/warraw/warraw-tb.c
View file @
44a6271c
...
@@ -30,7 +30,7 @@ int main(int argc, char **argv)
...
@@ -30,7 +30,7 @@ int main(int argc, char **argv)
int
data
[
SZ
],
i
,
ret
=
0
,
s
=
0
;
int
data
[
SZ
],
i
,
ret
=
0
,
s
=
0
;
for
(
i
=
0
;
i
<
SZ
;
++
i
)
for
(
i
=
0
;
i
<
SZ
;
++
i
)
data
[
i
]
=
i
+
1
;
data
[
i
]
=
i
+
1
;
s
=
warraw
(
data
);
s
=
warraw
(
data
);
for
(
i
=
0
;
i
<
SZ
;
++
i
)
{
for
(
i
=
0
;
i
<
SZ
;
++
i
)
{
...
...
platform/tests/iplatform.c
View file @
44a6271c
...
@@ -221,7 +221,7 @@ static int runtest(long const which)
...
@@ -221,7 +221,7 @@ static int runtest(long const which)
for
(
long
t
=
0
;
t
<
thrdcnt
;
++
t
)
for
(
long
t
=
0
;
t
<
thrdcnt
;
++
t
)
pthread_join
(
threads
[
t
],
NULL
);
pthread_join
(
threads
[
t
],
NULL
);
platform_deinit
();
platform_deinit
();
return
errors
+
terrors
;
return
errors
+
terrors
;
}
}
...
...
platform/tests/platform_slots.c
View file @
44a6271c
...
@@ -104,7 +104,7 @@ int main(int argc, char **argv)
...
@@ -104,7 +104,7 @@ int main(int argc, char **argv)
cfg
.
slot_id
=
strtoul
(
argv
[
1
],
NULL
,
0
);
cfg
.
slot_id
=
strtoul
(
argv
[
1
],
NULL
,
0
);
else
else
cfg
.
slot_id
=
-
1
;
cfg
.
slot_id
=
-
1
;
if
(
argc
>
2
)
if
(
argc
>
2
)
cfg
.
delay
=
strtoul
(
argv
[
2
],
NULL
,
0
);
cfg
.
delay
=
strtoul
(
argv
[
2
],
NULL
,
0
);
else
else
...
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
...
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
cfg
.
iterations
=
1
;
cfg
.
iterations
=
1
;
cfg
.
mt
=
cfg
.
all_slots
&&
argc
>
4
;
cfg
.
mt
=
cfg
.
all_slots
&&
argc
>
4
;
printf
(
"Starting: all_slots = %ld, slot_id = %ld, delay = %ld, iterations = %ld
\n
"
,
printf
(
"Starting: all_slots = %ld, slot_id = %ld, delay = %ld, iterations = %ld
\n
"
,
cfg
.
all_slots
,
cfg
.
slot_id
,
cfg
.
delay
,
cfg
.
iterations
);
cfg
.
all_slots
,
cfg
.
slot_id
,
cfg
.
delay
,
cfg
.
iterations
);
...
...
platform/tests/platform_stress_alloc.c
View file @
44a6271c
...
@@ -144,9 +144,9 @@ int main(int argc, char **argv)
...
@@ -144,9 +144,9 @@ int main(int argc, char **argv)
pthread_create
(
&
threads
[
t
],
NULL
,
stress
,
(
void
*
)
runs
);
pthread_create
(
&
threads
[
t
],
NULL
,
stress
,
(
void
*
)
runs
);
for
(
t
=
0
;
t
<
thread_count
;
++
t
)
for
(
t
=
0
;
t
<
thread_count
;
++
t
)
pthread_join
(
threads
[
t
],
NULL
);
pthread_join
(
threads
[
t
],
NULL
);
platform_deinit
();
platform_deinit
();
if
(
!
stop
)
if
(
!
stop
)
printf
(
"Test successful.
\n
"
);
printf
(
"Test successful.
\n
"
);
else
else
...
...
platform/vc709/src/buddy_allocator/buddy_allocator.cpp
View file @
44a6271c
...
@@ -19,20 +19,20 @@
...
@@ -19,20 +19,20 @@
#include "buddy_allocator.hpp"
#include "buddy_allocator.hpp"
buddy_allocator
::
buddy_allocator
(
uint32_t
_address
,
uint_fast32_t
_size
,
uint_fast32_t
_min_order
,
uint_fast32_t
_max_order
){
buddy_allocator
::
buddy_allocator
(
uint32_t
_address
,
uint_fast32_t
_size
,
uint_fast32_t
_min_order
,
uint_fast32_t
_max_order
){
log
(
logDEBUG2
)
<<
"Calculate init values for buddy_tree"
;
log
(
logDEBUG2
)
<<
"Calculate init values for buddy_tree"
;
min_order
=
_min_order
;
min_order
=
_min_order
;
max_order
=
_max_order
;
max_order
=
_max_order
;
uint32_t
address
=
calc_Address
(
_address
);
uint32_t
address
=
calc_Address
(
_address
);
uint_fast32_t
size
=
calc_Size
(
_size
,
address
-
_address
);
uint_fast32_t
size
=
calc_Size
(
_size
,
address
-
_address
);
log
(
logDEBUG2
)
<<
"Set init values for buddy_tree (size: "
<<
size
<<
") vs. "
<<
calc_Size
(
_size
,
address
-
_address
);
log
(
logDEBUG2
)
<<
"Set init values for buddy_tree (size: "
<<
size
<<
") vs. "
<<
calc_Size
(
_size
,
address
-
_address
);
bt
=
new
buddy_tree
(
address
,
size
);
bt
=
new
buddy_tree
(
address
,
size
);
//bt->print_Tree(bt->get_Root());
//bt->print_Tree(bt->get_Root());
if
(
!
check_Tree
(
bt
->
get_Root
()))
{
if
(
!
check_Tree
(
bt
->
get_Root
()))
{
build_Tree
(
bt
->
get_Root
());
build_Tree
(
bt
->
get_Root
());
error
=
0
;
error
=
0
;
...
@@ -40,13 +40,13 @@ buddy_allocator::buddy_allocator(uint32_t _address, uint_fast32_t _size, uint_fa
...
@@ -40,13 +40,13 @@ buddy_allocator::buddy_allocator(uint32_t _address, uint_fast32_t _size, uint_fa
log
(
logWARNING
)
<<
"Tree could not be built completely"
;
log
(
logWARNING
)
<<
"Tree could not be built completely"
;
error
=
-
EINVAL
;
error
=
-
EINVAL
;
}
}
//bt->print_Tree(bt->get_Root());
//bt->print_Tree(bt->get_Root());
}
}
buddy_allocator
::~
buddy_allocator
()
{
buddy_allocator
::~
buddy_allocator
()
{
log
(
logDEBUG2
)
<<
"Delete buddy_tree"
;
log
(
logDEBUG2
)
<<
"Delete buddy_tree"
;
delete
(
bt
);
delete
(
bt
);
}
}
...
@@ -56,41 +56,41 @@ void buddy_allocator::print_Tree(void) {
...
@@ -56,41 +56,41 @@ void buddy_allocator::print_Tree(void) {
}
}
uint_fast32_t
buddy_allocator
::
dealloc_Mem
(
uint32_t
address
)
{
uint_fast32_t
buddy_allocator
::
dealloc_Mem
(
uint32_t
address
)
{
if
(
error
)
if
(
error
)
return
-
EINVAL
;
return
-
EINVAL
;
node_t
*
n
=
find_Node
(
address
);
node_t
*
n
=
find_Node
(
address
);
if
(
!
n
)
{
if
(
!
n
)
{
log
(
logWARNING
)
<<
"Node for address "
<<
hex
<<
address
<<
" not found"
<<
dec
;
log
(
logWARNING
)
<<
"Node for address "
<<
hex
<<
address
<<
" not found"
<<
dec
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
//bt->print_Node(n);
//bt->print_Node(n);
node_t
*
sibling
=
find_Sibling
(
n
);
node_t
*
sibling
=
find_Sibling
(
n
);
if
(
bt
->
dealloc_Leaf
(
n
))
{
if
(
bt
->
dealloc_Leaf
(
n
))
{
log
(
logWARNING
)
<<
"Failure in deallocation"
;
log
(
logWARNING
)
<<
"Failure in deallocation"
;
return
-
EINVAL
;
return
-
EINVAL
;
}
}
while
(
sibling
&&
sibling
->
usage
==
nodeFree
&&
n
->
size
<
(
uint_fast32_t
)(
1
<<
max_order
))
{
while
(
sibling
&&
sibling
->
usage
==
nodeFree
&&
n
->
size
<
(
uint_fast32_t
)(
1
<<
max_order
))
{
log
(
logDEBUG2
)
<<
"can merge nodes"
;
log
(
logDEBUG2
)
<<
"can merge nodes"
;
node_t
*
parent
=
n
->
parent
;
node_t
*
parent
=
n
->
parent
;
if
(
bt
->
merge_Node
(
parent
))
{
if
(
bt
->
merge_Node
(
parent
))
{
log
(
logWARNING
)
<<
"Merging gone wrong"
;
log
(
logWARNING
)
<<
"Merging gone wrong"
;
}
}
n
=
parent
;
n
=
parent
;
sibling
=
find_Sibling
(
n
);
sibling
=
find_Sibling
(
n
);
}
}
return
0
;
return
0
;
}
}
node_t
*
buddy_allocator
::
find_Sibling
(
node_t
*
n
)
{
node_t
*
buddy_allocator
::
find_Sibling
(
node_t
*
n
)
{
if
(
n
->
parent
)
{
if
(
n
->
parent
)
{
if
(
n
->
parent
->
l_child
==
n
)
if
(
n
->
parent
->
l_child
==
n
)
return
n
->
parent
->
r_child
;
return
n
->
parent
->
r_child
;
...
@@ -104,84 +104,84 @@ node_t * buddy_allocator::find_Sibling(node_t * n) {
...
@@ -104,84 +104,84 @@ node_t * buddy_allocator::find_Sibling(node_t * n) {
node_t
*
buddy_allocator
::
find_Node
(
uint32_t
address
)
{
node_t
*
buddy_allocator
::
find_Node
(
uint32_t
address
)
{
node_t
*
n
=
bt
->
get_Root
();
node_t
*
n
=
bt
->
get_Root
();
log
(
logDEBUG2
)
<<
"Search node with matching address "
<<
hex
<<
address
<<
dec
;
log
(
logDEBUG2
)
<<
"Search node with matching address "
<<
hex
<<
address
<<
dec
;
//bt->print_Node(n);
//bt->print_Node(n);
while
(
n
!=
NULL
&&
(
n
->
usage
!=
nodeAlloc
||
n
->
address
!=
address
))
{
while
(
n
!=
NULL
&&
(
n
->
usage
!=
nodeAlloc
||
n
->
address
!=
address
))
{
n
=
bt
->
search_Node
(
n
,
address
);
n
=
bt
->
search_Node
(
n
,
address
);
//bt->print_Node(n);
//bt->print_Node(n);
}
}
return
n
;
return
n
;
}
}
uint32_t
buddy_allocator
::
alloc_Mem
(
uint_fast32_t
_size
)
{
uint32_t
buddy_allocator
::
alloc_Mem
(
uint_fast32_t
_size
)
{
if
(
error
)
if
(
error
)
return
0
;
return
0
;
uint_fast32_t
size
=
fit_Order
(
_size
);
uint_fast32_t
size
=
fit_Order
(
_size
);
if
(
!
size
)
{
if
(
!
size
)
{
log
(
logINFO
)
<<
"Can't find matching order"
;
log
(
logINFO
)
<<
"Can't find matching order"
;
return
0
;
return
0
;
}
}
node_t
*
n
=
find_Free
(
size
);
node_t
*
n
=
find_Free
(
size
);
if
(
!
n
)
{
if
(
!
n
)
{
log
(
logINFO
)
<<
"Can't find matching node"
;
log
(
logINFO
)
<<
"Can't find matching node"
;
return
0
;
return
0
;
}
}
//bt->print_Node(n);
//bt->print_Node(n);
n
=
split_Till_Fit
(
n
,
size
);
n
=
split_Till_Fit
(
n
,
size
);
//bt->print_Node(n);
//bt->print_Node(n);
if
(
bt
->
alloc_Leaf
(
n
))
{
if
(
bt
->
alloc_Leaf
(
n
))
{
log
(
logWARNING
)
<<
"Allocation gone wrong"
;
log
(
logWARNING
)
<<
"Allocation gone wrong"
;
return
0
;
return
0
;
}
}
//bt->print_Tree(bt->get_Root());
//bt->print_Tree(bt->get_Root());
return
n
->
address
;
return
n
->
address
;
}
}
node_t
*
buddy_allocator
::
split_Till_Fit
(
node_t
*
_n
,
uint_fast32_t
size
)
{
node_t
*
buddy_allocator
::
split_Till_Fit
(
node_t
*
_n
,
uint_fast32_t
size
)
{
node_t
*
n
=
_n
;
node_t
*
n
=
_n
;
while
(
n
->
size
>
size
)
{
while
(
n
->
size
>
size
)
{
if
(
!
bt
->
split_Node
(
n
))
{
if
(
!
bt
->
split_Node
(
n
))
{
n
=
n
->
l_child
;
n
=
n
->
l_child
;
}
else
{
}
else
{
log
(
logWARNING
)
<<
"Splitting gone wrong"
;
log
(
logWARNING
)
<<
"Splitting gone wrong"
;
}
}
}
}