Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
rtos_mon_arch.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3
* Copyright (C) 2016 Michal Podhradsky <michal.podhradsky@aggiemail.usu.edu>
4
*
5
* This file is part of paparazzi
6
*
7
* paparazzi is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2, or (at your option)
10
* any later version.
11
*
12
* paparazzi is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with paparazzi; see the file COPYING. If not, see
19
* <http://www.gnu.org/licenses/>.
20
*/
28
#include "
modules/core/sys_mon_rtos.h
"
29
#include <stdlib.h>
/* atof */
30
#include <stdio.h>
/* printf, fgets */
31
#include <string.h>
32
33
void
rtos_mon_init_arch
(
void
) {}
34
35
// Ask for CPU usage of the process
36
void
rtos_mon_periodic_arch
(
void
)
37
{
38
char
line[20];
39
FILE *cmd = popen(
"ps -C simsitl -o %CPU"
,
"r"
);
40
41
char
*ret;
42
ret = fgets(line,
sizeof
(line), cmd);
43
ret = fgets(line,
sizeof
(line), cmd);
44
if
(ret != NULL) {
45
double
cpu = atof(ret);
46
rtos_mon
.
cpu_load
= (
uint8_t
)cpu;
47
}
48
pclose(cmd);
49
}
50
rtos_mon_init_arch
void rtos_mon_init_arch(void)
Definition:
rtos_mon_arch.c:39
rtos_mon_periodic_arch
void rtos_mon_periodic_arch(void)
Definition:
rtos_mon_arch.c:46
rtos_mon
struct rtos_monitoring rtos_mon
Definition:
rtos_mon.c:30
rtos_monitoring::cpu_load
uint8_t cpu_load
global CPU/MCU load in %
Definition:
sys_mon_rtos.h:51
uint8_t
unsigned char uint8_t
Definition:
types.h:14
sys_mon_rtos.h
System monitoring for RTOS targets return cpu load, average exec time, ...
sw
airborne
arch
sim
modules
core
rtos_mon_arch.c
Generated on Sat Feb 9 2019 07:05:34 for Paparazzi UAS by
1.8.8