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
1b2a4032
Commit
1b2a4032
authored
4 years ago
by
Georges Da Costa
Browse files
Options
Downloads
Patches
Plain Diff
Adds cli arguments for init of sensors
parent
6882f86a
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
load.c
+1
-1
1 addition, 1 deletion
load.c
load.h
+1
-1
1 addition, 1 deletion
load.h
mojitos.c
+5
-10
5 additions, 10 deletions
mojitos.c
with
7 additions
and
12 deletions
load.c
+
1
−
1
View file @
1b2a4032
...
@@ -43,7 +43,7 @@ void _get_load(uint64_t* results) {
...
@@ -43,7 +43,7 @@ void _get_load(uint64_t* results) {
// Public interface
// Public interface
unsigned
int
init_load
(
void
**
state
)
{
unsigned
int
init_load
(
char
*
argument
,
void
**
state
)
{
load_fid
=
open
(
"/proc/stat"
,
O_RDONLY
);
load_fid
=
open
(
"/proc/stat"
,
O_RDONLY
);
_get_load
(
load_values
);
_get_load
(
load_values
);
return
10
;
return
10
;
...
...
This diff is collapsed.
Click to expand it.
load.h
+
1
−
1
View file @
1b2a4032
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
*******************************************************/
*******************************************************/
unsigned
int
init_load
(
void
**
);
unsigned
int
init_load
(
char
*
,
void
**
);
unsigned
int
get_load
(
uint64_t
*
results
,
void
*
);
unsigned
int
get_load
(
uint64_t
*
results
,
void
*
);
void
clean_load
(
void
*
);
void
clean_load
(
void
*
);
void
label_load
(
char
**
labels
);
void
label_load
(
char
**
labels
);
This diff is collapsed.
Click to expand it.
mojitos.c
+
5
−
10
View file @
1b2a4032
...
@@ -111,7 +111,7 @@ void flushexit() {
...
@@ -111,7 +111,7 @@ void flushexit() {
fclose
(
output
);
fclose
(
output
);
}
}
typedef
unsigned
int
(
initializer_t
)(
void
**
);
typedef
unsigned
int
(
initializer_t
)(
char
*
,
void
**
);
typedef
void
(
labeler_t
)(
char
**
);
typedef
void
(
labeler_t
)(
char
**
);
typedef
unsigned
int
(
*
getter_t
)(
uint64_t
*
,
void
*
);
typedef
unsigned
int
(
*
getter_t
)(
uint64_t
*
,
void
*
);
typedef
void
(
*
cleaner_t
)(
void
*
);
typedef
void
(
*
cleaner_t
)(
void
*
);
...
@@ -125,7 +125,7 @@ unsigned int nb_sensors=0;
...
@@ -125,7 +125,7 @@ unsigned int nb_sensors=0;
char
**
labels
=
NULL
;
char
**
labels
=
NULL
;
uint64_t
*
values
=
NULL
;
uint64_t
*
values
=
NULL
;
void
add_source
(
initializer_t
init
,
labeler_t
labeler
,
void
add_source
(
initializer_t
init
,
char
*
arg
,
labeler_t
labeler
,
getter_t
get
,
cleaner_t
clean
)
{
getter_t
get
,
cleaner_t
clean
)
{
nb_sources
++
;
nb_sources
++
;
states
=
realloc
(
states
,
nb_sources
*
sizeof
(
void
*
));
states
=
realloc
(
states
,
nb_sources
*
sizeof
(
void
*
));
...
@@ -133,7 +133,7 @@ void add_source(initializer_t init, labeler_t labeler,
...
@@ -133,7 +133,7 @@ void add_source(initializer_t init, labeler_t labeler,
getter
[
nb_sources
-
1
]
=
get
;
getter
[
nb_sources
-
1
]
=
get
;
cleaner
=
realloc
(
cleaner
,
nb_sources
*
sizeof
(
void
*
));
cleaner
=
realloc
(
cleaner
,
nb_sources
*
sizeof
(
void
*
));
cleaner
[
nb_sources
-
1
]
=
clean
;
cleaner
[
nb_sources
-
1
]
=
clean
;
int
nb
=
init
(
&
states
[
nb_sources
-
1
]);
int
nb
=
init
(
arg
,
&
states
[
nb_sources
-
1
]);
labels
=
realloc
(
labels
,
(
nb_sensors
+
nb
)
*
sizeof
(
char
*
));
labels
=
realloc
(
labels
,
(
nb_sensors
+
nb
)
*
sizeof
(
char
*
));
labeler
(
labels
+
nb_sensors
);
labeler
(
labels
+
nb_sensors
);
...
@@ -152,7 +152,6 @@ int main(int argc, char **argv) {
...
@@ -152,7 +152,6 @@ int main(int argc, char **argv) {
int
rapl_mode
=
-
1
;
int
rapl_mode
=
-
1
;
int
perf_mode
=
-
1
;
int
perf_mode
=
-
1
;
int
load_mode
=
-
1
;
int
stat_mode
=
-
1
;
int
stat_mode
=
-
1
;
if
(
argc
==
1
)
if
(
argc
==
1
)
...
@@ -198,7 +197,7 @@ int main(int argc, char **argv) {
...
@@ -198,7 +197,7 @@ int main(int argc, char **argv) {
rapl_mode
=
0
;
rapl_mode
=
0
;
break
;
break
;
case
'u'
:
case
'u'
:
load_mode
=
0
;
add_source
(
init_load
,
NULL
,
label_load
,
get_load
,
clean_load
)
;
break
;
break
;
case
's'
:
case
's'
:
stat_mode
=
0
;
stat_mode
=
0
;
...
@@ -210,9 +209,6 @@ int main(int argc, char **argv) {
...
@@ -210,9 +209,6 @@ int main(int argc, char **argv) {
usage
(
argv
);
usage
(
argv
);
}
}
// Load initialization
if
(
load_mode
==
0
)
add_source
(
init_load
,
label_load
,
get_load
,
clean_load
);
// Network initialization
// Network initialization
int
*
network_sources
=
NULL
;
int
*
network_sources
=
NULL
;
...
@@ -388,8 +384,7 @@ int main(int argc, char **argv) {
...
@@ -388,8 +384,7 @@ int main(int argc, char **argv) {
}
}
for
(
int
i
=
0
;
i
<
nb_sources
;
i
++
)
for
(
int
i
=
0
;
i
<
nb_sources
;
i
++
)
cleaner
[
i
](
states
[
i
]);
cleaner
[
i
](
states
[
i
]);
// if(load_mode == 0)
// clean_load(load_state);
if
(
dev
!=
NULL
)
if
(
dev
!=
NULL
)
clean_network
(
network_sources
);
clean_network
(
network_sources
);
if
(
infi_path
!=
NULL
)
if
(
infi_path
!=
NULL
)
...
...
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