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
f75b1b3b
Commit
f75b1b3b
authored
4 years ago
by
Georges Da Costa
Browse files
Options
Downloads
Patches
Plain Diff
Changes types of most monitored values to u64
parent
43fdc72b
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
load.c
+3
-2
3 additions, 2 deletions
load.c
load.h
+1
-1
1 addition, 1 deletion
load.h
mojitos.c
+11
-10
11 additions, 10 deletions
mojitos.c
network.c
+6
-2
6 additions, 2 deletions
network.c
network.h
+1
-1
1 addition, 1 deletion
network.h
with
22 additions
and
16 deletions
load.c
+
3
−
2
View file @
f75b1b3b
...
...
@@ -20,6 +20,7 @@
#include
<unistd.h>
#include
<fcntl.h>
#include
<stdlib.h>
#include
<stdint.h>
#define LOAD_BUFFER_SIZE 1024
char
buffer
[
LOAD_BUFFER_SIZE
];
...
...
@@ -30,12 +31,12 @@ void init_load() {
load_fid
=
open
(
"/proc/stat"
,
O_RDONLY
);
}
void
get_load
(
long
long
*
results
)
{
void
get_load
(
uint64_t
*
results
)
{
pread
(
load_fid
,
buffer
,
LOAD_BUFFER_SIZE
-
1
,
0
);
int
pos
=
0
;
while
(
buffer
[
pos
]
>
'9'
||
buffer
[
pos
]
<
'0'
)
pos
++
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
results
[
i
]
=
a
toll
(
buffer
+
pos
);
results
[
i
]
=
str
to
u
ll
(
buffer
+
pos
,
NULL
,
10
);
while
(
buffer
[
pos
]
<=
'9'
&&
buffer
[
pos
]
>=
'0'
)
pos
++
;
pos
++
;
}
...
...
This diff is collapsed.
Click to expand it.
load.h
+
1
−
1
View file @
f75b1b3b
...
...
@@ -19,5 +19,5 @@
*******************************************************/
void
init_load
();
void
get_load
(
long
long
*
results
);
void
get_load
(
uint64_t
*
results
);
void
clean_load
();
This diff is collapsed.
Click to expand it.
mojitos.c
+
11
−
10
View file @
f75b1b3b
...
...
@@ -90,7 +90,7 @@ void perf_event_list(char *perf_string, int *nb_perf, int **perf_indexes) {
int
load_mode
=
-
1
;
void
usage
(
char
**
argv
)
{
printf
(
"Usage : %s [-t time] [-f freq] [-r] [-p perf_list] [-l] [-u] [-d network_device] [-i infiniband_path] [-o logfile] [-e command arguments...]
\n
"
,
argv
[
0
]);
printf
(
"Usage : %s [-t time] [-f freq] [-r] [-p perf_list] [-l] [-u]
[-c]
[-d network_device] [-i infiniband_path] [-o logfile] [-e command arguments...]
\n
"
,
argv
[
0
]);
printf
(
"if time==0 then loops infinitively
\n
"
);
printf
(
"if -e is present, time and freq are not used
\n
"
);
printf
(
"-r activates RAPL
\n
"
);
...
...
@@ -101,6 +101,7 @@ void usage(char** argv) {
printf
(
"-i activates infiniband monitoring (if infiniband_path is X, tries to detect it automatically)
\n
"
);
printf
(
"-s activates statistics of overhead in nanoseconds
\n
"
);
printf
(
"-u activates report of system load
\n
"
);
printf
(
"-c activates report of processor temperature
\n
"
);
exit
(
EXIT_SUCCESS
);
}
...
...
@@ -191,8 +192,8 @@ int main(int argc, char **argv) {
int
*
network_sources
=
NULL
;
if
(
dev
!=
NULL
)
network_sources
=
init_network
(
dev
);
long
long
network_values
[
4
]
=
{
0
,
0
,
0
,
0
};
long
long
tmp_network_values
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
network_values
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
tmp_network_values
[
4
]
=
{
0
,
0
,
0
,
0
};
get_network
(
network_values
,
network_sources
);
int
*
infiniband_sources
=
NULL
;
...
...
@@ -200,13 +201,13 @@ int main(int argc, char **argv) {
infiniband_sources
=
init_infiniband
(
infi_path
);
if
(
infiniband_sources
==
NULL
)
infi_path
=
NULL
;
long
long
infiniband_values
[
4
]
=
{
0
,
0
,
0
,
0
};
long
long
tmp_infiniband_values
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
infiniband_values
[
4
]
=
{
0
,
0
,
0
,
0
};
uint64_t
tmp_infiniband_values
[
4
]
=
{
0
,
0
,
0
,
0
};
get_network
(
infiniband_values
,
infiniband_sources
);
// Load initialization
long
long
load_values
[
10
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
long
long
tmp_load_values
[
10
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
uint64_t
load_values
[
10
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
uint64_t
tmp_load_values
[
10
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
if
(
load_mode
==
0
)
{
init_load
();
get_load
(
load_values
);
...
...
@@ -320,16 +321,16 @@ int main(int argc, char **argv) {
fprintf
(
output
,
"%lld "
,
counter_values
[
i
]);
if
(
dev
!=
NULL
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
fprintf
(
output
,
"%
lld
"
,
tmp_network_values
[
i
]
-
network_values
[
i
]);
fprintf
(
output
,
"%
"
PRIu64
"
"
,
tmp_network_values
[
i
]
-
network_values
[
i
]);
if
(
infi_path
!=
NULL
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
fprintf
(
output
,
"%
lld
"
,
tmp_infiniband_values
[
i
]
-
infiniband_values
[
i
]);
fprintf
(
output
,
"%
"
PRIu64
"
"
,
tmp_infiniband_values
[
i
]
-
infiniband_values
[
i
]);
if
(
rapl_mode
==
0
)
for
(
int
r
=
0
;
r
<
rapl
->
nb
;
r
++
)
fprintf
(
output
,
"%"
PRIu64
" "
,
tmp_rapl_values
[
r
]
-
rapl_values
[
r
]);
if
(
load_mode
==
0
)
for
(
int
i
=
0
;
i
<
10
;
i
++
)
fprintf
(
output
,
"%
lld
"
,
tmp_load_values
[
i
]
-
load_values
[
i
]);
fprintf
(
output
,
"%
"
PRIu64
"
"
,
tmp_load_values
[
i
]
-
load_values
[
i
]);
if
(
stat_mode
==
0
)
fprintf
(
output
,
"%ld "
,
stat_data
);
...
...
This diff is collapsed.
Click to expand it.
network.c
+
6
−
2
View file @
f75b1b3b
...
...
@@ -22,6 +22,7 @@
#include
<stdlib.h>
#include
<stdio.h>
#include
<string.h>
#include
<stdint.h>
int
*
init_network
(
char
*
dev
)
{
if
(
dev
==
NULL
)
...
...
@@ -52,13 +53,16 @@ int *init_network(char* dev) {
return
sources
;
}
void
get_network
(
long
long
*
results
,
int
*
sources
)
{
void
get_network
(
uint64_t
*
results
,
int
*
sources
)
{
if
(
sources
==
NULL
)
return
;
char
buffer
[
128
];
for
(
int
i
=
0
;
i
<
4
;
i
++
){
pread
(
sources
[
i
],
buffer
,
127
,
0
);
results
[
i
]
=
atoll
(
buffer
);
results
[
i
]
=
strtoull
(
buffer
,
NULL
,
10
);
//results[i] = atoll(buffer);
}
}
...
...
This diff is collapsed.
Click to expand it.
network.h
+
1
−
1
View file @
f75b1b3b
...
...
@@ -19,5 +19,5 @@
*******************************************************/
int
*
init_network
(
char
*
dev
);
void
get_network
(
long
long
*
results
,
int
*
sources
);
void
get_network
(
uint64_t
*
results
,
int
*
sources
);
void
clean_network
(
int
*
sources
);
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