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
6ff2876a
Commit
6ff2876a
authored
4 years ago
by
Georges Da Costa
Browse files
Options
Downloads
Patches
Plain Diff
Changes the type for performance counters to uint64
parent
a51c4116
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
counters.h
+1
-1
1 addition, 1 deletion
counters.h
counters_individual.c
+8
-5
8 additions, 5 deletions
counters_individual.c
makefile
+1
-1
1 addition, 1 deletion
makefile
mojitos.c
+14
-8
14 additions, 8 deletions
mojitos.c
with
24 additions
and
15 deletions
counters.h
+
1
−
1
View file @
6ff2876a
...
...
@@ -26,4 +26,4 @@ counter_t init_counters(const int nb_perf, const __u32 *types, const __u64 *name
void
clean_counters
(
counter_t
fd
);
void
start_counters
(
counter_t
fd
);
void
reset_counters
(
counter_t
fd
);
void
get_counters
(
counter_t
fd
,
long
long
*
values
);
void
get_counters
(
counter_t
fd
,
uint64_t
*
values
);
This diff is collapsed.
Click to expand it.
counters_individual.c
+
8
−
5
View file @
6ff2876a
...
...
@@ -26,6 +26,7 @@
#include
<stdio.h>
#include
<stdint.h>
#include
<asm/unistd.h>
#include
<stdint.h>
#include
"counters.h"
...
...
@@ -91,19 +92,21 @@ void reset_counters(counter_t counters) {
ioctl
(
counters
->
counters
[
counter
][
core
],
PERF_EVENT_IOC_RESET
,
0
);
}
void
get_counters
(
counter_t
counters
,
long
long
*
values
)
{
void
get_counters
(
counter_t
counters
,
uint64_t
*
values
)
{
//memset(values, 0, nb_perf*sizeof(long long));
for
(
int
i
=
0
;
i
<
counters
->
nbperf
;
i
++
)
{
long
long
accu
=
0
;
long
long
count
;
uint64_t
accu
=
0
;
uint64_t
count
=
0
;
for
(
int
core
=
0
;
core
<
counters
->
nbcores
;
core
++
)
{
if
(
-
1
==
read
(
counters
->
counters
[
i
][
core
],
&
count
,
sizeof
(
long
long
)))
{
if
(
-
1
==
read
(
counters
->
counters
[
i
][
core
],
&
count
,
sizeof
(
uint64_t
)))
{
fprintf
(
stderr
,
"PB Lecture resultat"
);
exit
(
EXIT_FAILURE
);
}
accu
+=
count
;
}
printf
(
"%lu!
\n
"
,
accu
);
values
[
i
]
=
accu
;
}
reset_counters
(
counters
);
//
reset_counters(counters);
}
This diff is collapsed.
Click to expand it.
makefile
+
1
−
1
View file @
6ff2876a
all
:
mojitos
OBJECTS
=
mojitos.o counters_individual.o
counters.h
rapl.o network.o load.o infiniband.o
OBJECTS
=
mojitos.o counters_individual.o rapl.o network.o load.o infiniband.o
mojitos
:
$(OBJECTS) counters_option.h
gcc
$(
DEBUG
)
-O3
-Wall
-o
mojitos
$(
OBJECTS
)
-lpowercap
...
...
This diff is collapsed.
Click to expand it.
mojitos.c
+
14
−
8
View file @
6ff2876a
...
...
@@ -221,9 +221,9 @@ int main(int argc, char **argv) {
// prepare rapl data stores
rapl_size
=
rapl
->
nb
*
sizeof
(
uint64_t
);
//rapl_values = malloc(rapl_size);
rapl_values
=
calloc
(
sizeof
(
char
),
rapl_size
);
rapl_values
=
calloc
(
sizeof
(
uint64_t
),
rapl_size
);
//tmp_rapl_values = malloc(rapl_size);
tmp_rapl_values
=
calloc
(
sizeof
(
char
),
rapl_size
);
tmp_rapl_values
=
calloc
(
sizeof
(
uint64_t
),
rapl_size
);
// initialize with dummy values
get_rapl
(
rapl_values
,
rapl
);
}
...
...
@@ -231,13 +231,16 @@ int main(int argc, char **argv) {
__u32
*
perf_type
;
__u64
*
perf_key
;
counter_t
fd
=
0
;
long
long
*
counter_values
=
NULL
;
uint64_t
*
counter_values
=
NULL
;
uint64_t
*
tmp_counter_values
=
NULL
;
if
(
perf_mode
==
0
)
{
perf_type_key
(
&
perf_type
,
&
perf_key
,
perf_indexes
,
nb_perf
);
fd
=
init_counters
(
nb_perf
,
perf_type
,
perf_key
);
reset_counters
(
fd
);
// reading HPC will reset their values so no need for a buffer
counter_values
=
malloc
(
nb_perf
*
sizeof
(
long
long
));
counter_values
=
malloc
(
nb_perf
*
sizeof
(
uint64_t
));
tmp_counter_values
=
malloc
(
nb_perf
*
sizeof
(
uint64_t
));
get_counters
(
fd
,
counter_values
);
}
struct
timespec
ts
;
struct
timespec
ts_ref
;
...
...
@@ -272,7 +275,7 @@ int main(int argc, char **argv) {
// Get Data
if
(
perf_mode
==
0
)
get_counters
(
fd
,
counter_values
);
get_counters
(
fd
,
tmp_
counter_values
);
if
(
dev
!=
NULL
)
get_network
(
tmp_network_values
,
network_sources
);
if
(
infi_path
!=
NULL
)
...
...
@@ -316,7 +319,7 @@ int main(int argc, char **argv) {
}
if
(
perf_mode
==
0
)
for
(
int
i
=
0
;
i
<
nb_perf
;
i
++
)
fprintf
(
output
,
"%
lld "
,
counter_values
[
i
]);
fprintf
(
output
,
"%
"
PRIu64
" "
,
tmp_counter_values
[
i
]
-
counter_values
[
i
]);
if
(
dev
!=
NULL
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
fprintf
(
output
,
"%"
PRIu64
" "
,
tmp_network_values
[
i
]
-
network_values
[
i
]);
...
...
@@ -337,6 +340,8 @@ int main(int argc, char **argv) {
if
(
application
!=
NULL
)
break
;
if
(
perf_mode
==
0
)
memcpy
(
counter_values
,
tmp_counter_values
,
nb_perf
*
sizeof
(
uint64_t
));
if
(
rapl_mode
==
0
)
memcpy
(
rapl_values
,
tmp_rapl_values
,
rapl_size
);
if
(
load_mode
==
0
)
...
...
@@ -363,6 +368,7 @@ int main(int argc, char **argv) {
if
(
perf_mode
==
0
){
clean_counters
(
fd
);
free
(
counter_values
);
free
(
tmp_counter_values
);
free
(
perf_type
);
free
(
perf_key
);
free
(
perf_indexes
);
...
...
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