93 lines
1.5 KiB
Markdown
93 lines
1.5 KiB
Markdown
# Damien Riera - Tom Momméja - Gaston Chenet
|
|
|
|
## daemon.c
|
|
|
|
### create_daemon()
|
|
|
|
cette fonction a une complexité de 4
|
|
|
|
### ping_request()
|
|
|
|
Cette fonction a une complexité de 2
|
|
|
|
### send_check()
|
|
|
|
Cette fonction a une complexité de 3
|
|
|
|
### check_keep_working()
|
|
|
|
Cette fonction a une complexité de 4
|
|
|
|
### daemon_work()
|
|
|
|
Cette fonction a une complexité de 3
|
|
|
|
## db-sqlite.c
|
|
|
|
### db_connect() - db_disconnect() - insert_hourly_report()
|
|
|
|
Toutes ces fonctions ont une complexité de 1
|
|
|
|
## ping-report.c
|
|
|
|
### main()
|
|
|
|
Cette fonction a une complexité de 4
|
|
|
|
## stats.c
|
|
|
|
### get_ping_from_temp_log()
|
|
|
|
Cette fonction a une complexité aux alentours de 15
|
|
|
|

|
|
|
|
### write_ping_log()
|
|
|
|
Cette fonction a une complexité de 4
|
|
|
|
### set_stats_ping()
|
|
|
|
Cette fonction a une complexité de 9
|
|
|
|

|
|
|
|
## utils.c
|
|
|
|
### write_pid_file()
|
|
|
|
Cette fonction a une commplexité de 2
|
|
|
|
### remove_file()
|
|
|
|
Cette fonction a une complexité de 1
|
|
|
|
# Réduire la complexité de set_stats_ping()
|
|
|
|
```c
|
|
/* Check if the ping is flagged as LOSS */
|
|
if(strcmp(read_line,"LOSS") == 0){
|
|
nb_loss++;
|
|
}else{
|
|
/* Evaluate the ping as a double */
|
|
ping = strtod(read_line,NULL);
|
|
/* Test null ping */
|
|
if(ping < 0.1){
|
|
/* Ignore null ping */
|
|
}
|
|
/* ... */
|
|
}
|
|
```
|
|
|
|
à:
|
|
|
|
```c
|
|
/* Evaluate the ping as a double */
|
|
ping = strtod(read_line,NULL);
|
|
/* Check if the ping is flagged as LOSS */
|
|
if(strcmp(read_line,"LOSS") == 0 && ping < 0.1){
|
|
nb_loss++;
|
|
}
|
|
/* ... */
|
|
```
|