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
f1348876
Commit
f1348876
authored
2 years ago
by
floreal.risso
Browse files
Options
Downloads
Patches
Plain Diff
update header
parent
db433cca
No related branches found
No related tags found
2 merge requests
!9
fix sensor example (doc)
,
!7
Add memory counters and fix makefile
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/memory_counters.c
+12
-1
12 additions, 1 deletion
src/memory_counters.c
src/memory_counters.h
+54
-0
54 additions, 0 deletions
src/memory_counters.h
with
66 additions
and
1 deletion
src/memory_counters.c
+
12
−
1
View file @
f1348876
#include
"meminfo_option.h"
#include
<bits/stdint-uintn
.h
>
#include
"util
.h
"
#include
<fcntl.h>
#include
<info_reader.h>
#include
<inttypes.h>
...
...
@@ -107,3 +107,14 @@ void clean_memory_counters(void *ptr) {
free
(
counters
->
keys
);
free
(
ptr
);
}
void
*
show_all_memory_counters
(
void
*
none1
,
size_t
none2
)
{
for
(
unsigned
int
i
=
0
;
i
<
NB_COUNTERS
;
i
++
)
{
printf
(
"%s
\n
"
,
memory_counters
[
i
]);
}
UNUSED
(
none1
);
UNUSED
(
none2
);
exit
(
EXIT_SUCCESS
);
return
NULL
;
/* not reached */
}
This diff is collapsed.
Click to expand it.
src/memory_counters.h
0 → 100644
+
54
−
0
View file @
f1348876
/*******************************************************
Copyright (C) 2023-2023 Georges Da Costa <georges.da-costa@irit.fr>
This file is part of Mojitos.
Mojitos is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mojitos is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MojitO/S. If not, see <https://www.gnu.org/licenses/>.
*******************************************************/
unsigned
int
init_memory_counters
(
char
*
args
,
void
**
ptr
);
unsigned
int
get_memory_counters
(
uint64_t
*
results
,
void
*
ptr
);
void
label_memory_counters
(
char
**
labels
,
void
*
ptr
);
void
clean_memory_counters
(
void
*
ptr
);
void
*
show_all_memory_counters
(
void
*
,
size_t
);
sensor
memory_counters
=
{
.
init
=
init_memory_counters
,
.
get
=
get_memory_counters
,
.
clean
=
clean_memory_counters
,
.
label
=
label_memory_counters
,
.
nb_opt
=
2
,
};
Optparse
memory_counters_opt
[
2
]
=
{
{
.
longname
=
"memory-counters"
,
.
shortname
=
'M'
,
.
argtype
=
OPTPARSE_REQUIRED
,
.
usage_arg
=
"<memory_list>"
,
.
usage_msg
=
"memory counters
\n
"
"
\t
memory_list is a coma separated list of memory counters.
\n
"
"
\t
Ex: Zswap,Zswapped"
,
},
{
.
longname
=
"memory-list"
,
.
shortname
=
'L'
,
.
argtype
=
OPTPARSE_NONE
,
.
usage_arg
=
NULL
,
.
usage_msg
=
"list the available performance counters and quit"
,
.
fn
=
show_all_memory_counters
,
},
};
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