Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MojitOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
MojitOS
Commits
881086c7
Commit
881086c7
authored
2 years ago
by
floreal.risso
Browse files
Options
Downloads
Patches
Plain Diff
fix: make format
parent
e6199994
No related branches found
No related tags found
2 merge requests
!9
fix sensor example (doc)
,
!7
Add memory counters and fix makefile
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/amd_rapl.c
+17
-17
17 additions, 17 deletions
src/amd_rapl.c
src/network.c
+3
-3
3 additions, 3 deletions
src/network.c
tests/info_reader.c
+5
-4
5 additions, 4 deletions
tests/info_reader.c
tests/util.c
+28
-28
28 additions, 28 deletions
tests/util.c
with
53 additions
and
52 deletions
src/amd_rapl.c
+
17
−
17
View file @
881086c7
...
@@ -201,7 +201,7 @@ void debug_print_amd_rapl(AmdRapl *rapl)
...
@@ -201,7 +201,7 @@ void debug_print_amd_rapl(AmdRapl *rapl)
unsigned
int
get_nb_cpu
()
unsigned
int
get_nb_cpu
()
{
{
char
filename
[
BUFFER_SIZE
];
char
filename
[
BUFFER_SIZE
];
int
cpy_errno
;
int
cpy_errno
;
unsigned
int
n_cpu
=
0
;
unsigned
int
n_cpu
=
0
;
for
(;;
n_cpu
++
)
{
for
(;;
n_cpu
++
)
{
...
@@ -215,22 +215,22 @@ unsigned int get_nb_cpu()
...
@@ -215,22 +215,22 @@ unsigned int get_nb_cpu()
close
(
fd
);
close
(
fd
);
}
}
if
(
n_cpu
==
0
)
{
if
(
n_cpu
==
0
)
{
perror
(
"open()"
);
perror
(
"open()"
);
fprintf
(
stderr
,
"on the file: '%s'
\n
"
,
filename
);
fprintf
(
stderr
,
"on the file: '%s'
\n
"
,
filename
);
switch
(
cpy_errno
)
{
switch
(
cpy_errno
)
{
case
ENOENT
:
case
ENOENT
:
fprintf
(
stderr
,
"Amd rapl works with msr module, try to run 'sudo modprobe msr', then retry.
\n
"
);
fprintf
(
stderr
,
"Amd rapl works with msr module, try to run 'sudo modprobe msr', then retry.
\n
"
);
exit
(
99
);
exit
(
99
);
case
EACCES
:
case
EACCES
:
fprintf
(
stderr
,
"Amd rapl must be executed with the administrator privilege, try with 'sudo'.
\n
"
);
fprintf
(
stderr
,
"Amd rapl must be executed with the administrator privilege, try with 'sudo'.
\n
"
);
exit
(
98
);
exit
(
98
);
default:
default:
fprintf
(
stderr
,
"Unexpected error
\n
"
);
fprintf
(
stderr
,
"Unexpected error
\n
"
);
exit
(
97
);
exit
(
97
);
}
}
}
}
// n_cpu > 0
// n_cpu > 0
return
n_cpu
;
return
n_cpu
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/network.c
+
3
−
3
View file @
881086c7
...
@@ -159,9 +159,9 @@ unsigned int init_network(char *dev, void **ptr)
...
@@ -159,9 +159,9 @@ unsigned int init_network(char *dev, void **ptr)
/* compare dev name to the previously saved one */
/* compare dev name to the previously saved one */
int
newdev
=
1
;
int
newdev
=
1
;
for
(
int
i
=
0
;
i
<
state
->
ndev
&&
newdev
;
i
++
)
{
for
(
int
i
=
0
;
i
<
state
->
ndev
&&
newdev
;
i
++
)
{
if
(
strncmp
(
start_of_dev
,
state
->
devs
[
i
],
s
-
start_of_dev
)
==
0
)
{
if
(
strncmp
(
start_of_dev
,
state
->
devs
[
i
],
s
-
start_of_dev
)
==
0
)
{
newdev
=
0
;
newdev
=
0
;
}
}
}
}
if
(
newdev
)
{
if
(
newdev
)
{
if
(
state
->
ndev
>=
NB_MAX_DEV
)
{
if
(
state
->
ndev
>=
NB_MAX_DEV
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/info_reader.c
+
5
−
4
View file @
881086c7
...
@@ -287,7 +287,7 @@ TFUNCTION(test_match, {
...
@@ -287,7 +287,7 @@ TFUNCTION(test_match, {
#define __NB_KEYS 4
#define __NB_KEYS 4
typedef
struct
{
typedef
struct
{
int
values
[
__NB_KEYS
];
int
values
[
__NB_KEYS
];
}
IntArray
;
}
IntArray
;
GenericPointer
__test_file_int_allocator
(
char
*
s
)
GenericPointer
__test_file_int_allocator
(
char
*
s
)
...
@@ -298,7 +298,7 @@ GenericPointer __test_file_int_allocator(char *s)
...
@@ -298,7 +298,7 @@ GenericPointer __test_file_int_allocator(char *s)
void
__test_file_set_int
(
GenericPointer
storage
,
GenericPointer
data
)
void
__test_file_set_int
(
GenericPointer
storage
,
GenericPointer
data
)
{
{
IntArray
*
array
=
(
IntArray
*
)
storage
;
IntArray
*
array
=
(
IntArray
*
)
storage
;
int
i
=
(
int
)
data
;
int
i
=
(
int
)
data
;
array
->
values
[
i
]
=
i
;
array
->
values
[
i
]
=
i
;
}
}
...
@@ -319,11 +319,12 @@ TFUNCTION(test_dummy_file, {
...
@@ -319,11 +319,12 @@ TFUNCTION(test_dummy_file, {
expected
.
values
[
3
]
=
3
;
expected
.
values
[
3
]
=
3
;
Parser
parser
;
Parser
parser
;
FILE
*
file
=
fopen
(
"./tests/info_reader_test.txt"
,
"r"
);
FILE
*
file
=
fopen
(
"./tests/info_reader_test.txt"
,
"r"
);
INIT_PARSER
(
parser
,
(
GenericPointer
)
&
results
,
0
,
1
,
sizeof
(
IntArray
),
keys
,
__NB_KEYS
,
file
);
INIT_PARSER
(
parser
,
(
GenericPointer
)
&
results
,
0
,
1
,
sizeof
(
IntArray
),
keys
,
__NB_KEYS
,
file
);
parse
(
&
parser
);
parse
(
&
parser
);
for
(
unsigned
int
i
=
0
;
i
<
__NB_KEYS
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
__NB_KEYS
;
i
++
)
{
TEST_INT
(
&
(
results
.
values
[
i
]),
&
(
expected
.
values
[
i
]));
TEST_INT
(
&
(
results
.
values
[
i
]),
&
(
expected
.
values
[
i
]));
}
}
fclose
(
file
);
fclose
(
file
);
...
...
This diff is collapsed.
Click to expand it.
tests/util.c
+
28
−
28
View file @
881086c7
...
@@ -78,45 +78,45 @@ TFUNCTION(test_modulo_substraction, {
...
@@ -78,45 +78,45 @@ TFUNCTION(test_modulo_substraction, {
})
})
TFUNCTION
(
test_max
,
{
TFUNCTION
(
test_max
,
{
int
expected
=
0
;
int
expected
=
0
;
int
result
=
0
;
int
result
=
0
;
expected
=
10
;
expected
=
10
;
result
=
MAX
(
expected
,
9
);
result
=
MAX
(
expected
,
9
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
expected
=
-
15
;
expected
=
-
15
;
result
=
MAX
(
expected
,
-
16
);
result
=
MAX
(
expected
,
-
16
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
expected
=
0
;
expected
=
0
;
result
=
MAX
(
expected
,
-
1
);
result
=
MAX
(
expected
,
-
1
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
expected
=
1
;
expected
=
1
;
result
=
MAX
(
expected
,
0
);
result
=
MAX
(
expected
,
0
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
})
})
TFUNCTION
(
test_min
,
{
TFUNCTION
(
test_min
,
{
int
expected
=
0
;
int
expected
=
0
;
int
result
=
0
;
int
result
=
0
;
expected
=
9
;
expected
=
9
;
result
=
MIN
(
expected
,
10
);
result
=
MIN
(
expected
,
10
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
expected
=
-
16
;
expected
=
-
16
;
result
=
MIN
(
expected
,
-
15
);
result
=
MIN
(
expected
,
-
15
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
expected
=
-
1
;
expected
=
-
1
;
result
=
MIN
(
expected
,
0
);
result
=
MIN
(
expected
,
0
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
expected
=
0
;
expected
=
0
;
result
=
MIN
(
expected
,
1
);
result
=
MIN
(
expected
,
1
);
TEST_INT
(
&
result
,
&
expected
);
TEST_INT
(
&
result
,
&
expected
);
})
})
TFILE_ENTRY_POINT
(
test_util
,
{
TFILE_ENTRY_POINT
(
test_util
,
{
...
...
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