Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTIの変更と管理アプリの追加 #467

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

YoshinoriTerazawa
Copy link

@YoshinoriTerazawa YoshinoriTerazawa commented Jul 15, 2024

Summary by CodeRabbit

  • New Features

    • Introduced inter-process communication via file monitoring.
    • Added functionality to manage checkpoints and control execution flow.
    • Enhanced process information storage and retrieval capabilities.
  • Refactor

    • Improved existing functions to integrate new inter-process communication and timer features.
  • Bug Fixes

    • Enhanced file I/O operations with locking mechanisms to ensure data integrity.

Copy link
Contributor

coderabbitai bot commented Jul 15, 2024

Walkthrough

The changes introduce an enhanced inter-process communication (IPC) system across multiple files, particularly focusing on file read/write operations monitored using inotify functions. This update includes managing process information, timer initiation based on checkpoints, countdowns, and program execution triggered by file modifications. Additionally, secure file I/O operations are implemented to ensure proper handling of process information in main.c.

Changes

File(s) Change Summary
QM_ver3.c, Monitoring_ver4.c Enhanced IPC via file monitoring, improved process management, and timer functionalities.
core/federated/RTI/main.c Added secure file I/O operations for writing process information with locking mechanisms.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4abce72 and f9611f6.

Files selected for processing (2)
  • QM_ver3.c (1 hunks)
  • core/federated/RTI/main.c (2 hunks)
Additional comments not posted (9)
QM_ver3.c (8)

53-56: LGTM!

The changes to time_count_start look good.


61-69: LGTM!

The changes to time_count_decrement look good.


74-111: LGTM!

The changes to count_down look good.


116-136: LGTM!

The changes to p_info_write look good.


141-199: LGTM!

The changes to wait_pid_and_pname look good.


204-251: LGTM!

The changes to executeProgram look good.


257-342: LGTM!

The changes to watch_cp_write look good.


344-381: LGTM!

The main function looks good.

core/federated/RTI/main.c (1)

281-322: LGTM!

The changes to the main function look good.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Outside diff range, codebase verification and nitpick comments (4)
core/federated/RTI/main.c (4)

Line range hint 157-280:
Add validation for arguments and check for integer overflow.

The function lacks validation for some arguments and has potential issues with integer overflow. Consider adding validation and checking for overflow.

-      rti.base.number_of_scheduling_nodes = (int32_t)num_federates; // FIXME: Loses numbers on 64-bit machines
+      if (num_federates > INT32_MAX) {
+          lf_print_error("--number_of_federates exceeds maximum value.");
+          usage(argc, argv);
+          return 0;
+      }
+      rti.base.number_of_scheduling_nodes = (int32_t)num_federates;

Line range hint 107-156:
Add validation for period and exchanges-per-interval values.

The function lacks validation for period and exchanges-per-interval values. Consider adding validation for these values.

-      rti.clock_sync_period_ns = (int64_t)period_ns;
+      if (period_ns < 0) {
+          lf_print_error("clock sync period must be non-negative.");
+          usage(argc, argv);
+          return i;
+      }
+      rti.clock_sync_period_ns = (int64_t)period_ns;

Line range hint 88-106:
Add error handling for lf_tracing_global_shutdown.

The function lacks error handling for lf_tracing_global_shutdown. Consider adding error handling for this operation.

-      lf_tracing_global_shutdown();
+      if (lf_tracing_global_shutdown() != 0) {
+          lf_print_error("Failed to save RTI trace file.");
+      }

Line range hint 66-78:
Add error handling for write_to_socket.

The function lacks error handling for write_to_socket. Consider adding error handling for this operation.

-  int failed = write_to_socket(fed->socket, bytes_to_write, &(buffer[0]));
+  int failed = write_to_socket(fed->socket, bytes_to_write, &(buffer[0]));
+  if (failed < 0) {
+      lf_print_error("RTI failed to send failed signal to federate %d on socket ID %d.", fed->enclave.id, fed->socket);
+  }
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f9611f6 and 51a2c1a.

Files selected for processing (2)
  • Monitoring_ver4.c (1 hunks)
  • core/federated/RTI/main.c (2 hunks)
Additional comments not posted (2)
core/federated/RTI/main.c (2)

Line range hint 79-106:
LGTM!

The function handles printing the usage information correctly.


282-324: Add error handling for flock and fclose failures.

The commented-out section lacks error handling for flock and fclose failures. Consider adding error handling for these operations.

-          fclose(file);
+          if (fclose(file) != 0) {
+              perror("RTI: Error closing file");
+              return 1;
+          }

Likely invalid or redundant comment.

Comment on lines 107 to 161
void p_info_write(process_info *p_info) {
//p_infoのメンバー変数を初期化
for (int i = 0; i < RTI_federate_nodes; ++i) {
// 各 process_info 構造体のメンバーを初期化
p_info[i].pid = 0;
p_info[i].p_state = 0;
p_info[i].fd = NULL;
memset(p_info[i].file_path, 0, sizeof(p_info[i].file_path));
memset(p_info[i].command, 0, sizeof(p_info[i].command));
memset(p_info[i].cp_num, 0, sizeof(p_info[i].cp_num));
memset(p_info[i].deadline, 0, sizeof(p_info[i].deadline));

// cp_array の各ポインタを NULL に初期化
for (int j = 0; j < max_cp_num; ++j) {
p_info[i].cp_array[j] = NULL;
}

// cp_info 構造体のインスタンスを動的に作成して初期化
for (int j = 0; j < max_cp_num; ++j) {
p_info[i].cp_array[j] = (cp_info*)malloc(sizeof(cp_info));
if (p_info[i].cp_array[j] == NULL) {
perror("Failed to allocate memory for cp_info");
}
p_info[i].cp_array[j]->check_do = false;
p_info[i].cp_array[j]->start_cp = false;
p_info[i].cp_array[j]->end_cp = false;
p_info[i].cp_array[j]->timer_count = 0;
}
}

//コマンドを格納
strcpy(p_info[0].command, "taskset -c 1 RTI -n 1 & echo $! > /home/yoshinoriterazawa/LF/RTI.txt");
strcpy(p_info[1].command, "taskset -c 0,2 /home/yoshinoriterazawa/LF/fed-gen/filewrite/bin/federate__writer & echo $! > /home/yoshinoriterazawa/LF/federate_writer.txt");

//通信用ファイルのパスを格納
strcpy(p_info[0].file_path, "/home/yoshinoriterazawa/LF/RTI.txt");
strcpy(p_info[1].file_path, "/home/yoshinoriterazawa/LF/federate_writer.txt");

//実行シーケンスの最初のCPを設定
p_info[1].cp_array[0]->start_cp = true;
p_info[1].cp_array[4]->start_cp = true;


//end_cp_num(最後のCP番号)を格納(とりあえずfederateのみ)
p_info[1].cp_array[3]->end_cp = true;
p_info[1].cp_array[7]->end_cp = true;

//デッドラインを格納(とりあえずfederateのみ)
p_info[1].deadline[0] = 1010;
p_info[1].deadline[1] = 100;
p_info[1].deadline[2] = 1010;
p_info[1].deadline[4] = 1010;
p_info[1].deadline[5] = 100;
p_info[1].deadline[6] = 1010;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error handling for memory allocation failures and use configuration for file paths.

The function lacks error handling for memory allocation failures and uses hardcoded file paths. Consider adding error handling and using configuration or arguments for file paths.

-            }
+                exit(EXIT_FAILURE);
+            }
-    strcpy(p_info[0].command, "taskset -c 1 RTI -n 1 & echo $! > /home/yoshinoriterazawa/LF/RTI.txt");
-    strcpy(p_info[1].command, "taskset -c 0,2 /home/yoshinoriterazawa/LF/fed-gen/filewrite/bin/federate__writer & echo $! > /home/yoshinoriterazawa/LF/federate_writer.txt");
+    // Use configuration or arguments for file paths
+    strcpy(p_info[0].command, "taskset -c 1 RTI -n 1 & echo $! > " CONFIG_RTI_PATH);
+    strcpy(p_info[1].command, "taskset -c 0,2 " CONFIG_FED_WRITER_PATH " & echo $! > " CONFIG_FED_WRITER_PID_PATH);

Comment on lines 166 to 209
void executeProgram(process_info *p_info, int wd[], int *inotify_fd) {
//監視のためにinotifyインスタンスを生成
if((*inotify_fd = inotify_init()) == -1) {
perror("Error inotify_init");
exit(EXIT_FAILURE);
}

for(int i =0; i < RTI_federate_nodes; i++) {
sleep(1);
int result = system(p_info[i].command);
if (result == -1) {
//デバッグ
perror("Error executing program");
} else {
//デバッグ
printf("QM: Command %s executed successfully\n", p_info[i].command);

//Pid取得
p_info[i].fd = fopen(p_info[i].file_path, "r+");
if(p_info[i].fd == NULL) {
perror("QM: Faild make file");
} else {
fscanf(p_info[i].fd, "%d", &(p_info[i].pid));
printf("QM: scanned pid %d\n", p_info[i].pid);
int fd = fileno(p_info[i].fd);
if(ftruncate(fd, 0) != 0) {
perror("Failed to truncate file\n");
close(fd);
}
}
fclose(p_info[i].fd);
printf("QM: file closed\n");


//通信用ファイルを監視対象に設定
wd[i] = inotify_add_watch(*inotify_fd, p_info[i].file_path, IN_MODIFY);
if(wd[i] == -1) {
perror("QM: Error inotify_add_watch");
exit(EXIT_FAILURE);
} else {
printf("QM: 監視対象設定完了\n");
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error handling for fopen and ftruncate failures and use configuration for sleep values.

The function lacks error handling for fopen and ftruncate failures and uses hardcoded sleep values. Consider adding error handling and using configuration or arguments for sleep values.

-                perror("QM: Faild make file");
+                perror("QM: Failed to open file");
+                exit(EXIT_FAILURE);
-        sleep(1);
+        sleep(CONFIG_SLEEP_INTERVAL);

Comment on lines 301 to 337
int main() {
process_info p_info[RTI_federate_nodes]; //RTI, federateの情報を格納する構造体配列の作成
int wd[RTI_federate_nodes]; //RTI, federateを監視するためのウォッチディスクリプタ配列
int inotify_fd; //inotifyインスタンスのファイルディスクリプタ
fd_set rdfs; //

/*カウントタイマー作成*/
int timer_fd;
struct itimerspec timer;
/*カウントタイマーの時間を設定.起動間隔1ms*/
timer.it_value.tv_sec = 0;
timer.it_value.tv_nsec = 1000000;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_nsec = 1000000;
timer_fd = timerfd_create(CLOCK_REALTIME, 0);
if (timer_fd == -1) {
perror("timerfd_create");
return EXIT_FAILURE;
}


//必要情報を先に記録する
p_info_write(p_info);

//RTI, federateの初期起動,コマンドを基に実行
executeProgram(p_info, wd, &inotify_fd);

//最大のファイルディスクリプタを設定
int max_fd = (inotify_fd > timer_fd ? inotify_fd : timer_fd) + 1;
FD_ZERO(&rdfs);
FD_SET(inotify_fd, &rdfs);
FD_SET(timer_fd, &rdfs);

//それぞれのプロセスからの通信を待つ
watch_cp_write(p_info, wd, timer, &inotify_fd, &timer_fd, &rdfs, max_fd);

return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error handling for timerfd_create and use configuration for timer intervals.

The function lacks error handling for timerfd_create and uses hardcoded values for timer intervals. Consider adding error handling and using configuration or arguments for timer intervals.

-    timer.it_value.tv_nsec = 1000000;
-    timer.it_interval.tv_nsec = 1000000;
+    timer.it_value.tv_nsec = CONFIG_TIMER_INTERVAL;
+    timer.it_interval.tv_nsec = CONFIG_TIMER_INTERVAL;

Committable suggestion was skipped due to low confidence.

Comment on lines 215 to 298
void watch_cp_write(process_info *p_info, int wd[], struct itimerspec timer, int *inotify_fd, int *timer_fd, fd_set *rdfs, int max_fd) {
char buffer[EVENT_BUF_LEN]; //イベント格納バッファ
char line[256];
timerfd_settime(*timer_fd, 0, &timer, NULL);
//int count = 0; //デバッグ用

while (1) {
// ファイル変更イベント,タイマーイベントを待つ
fd_set tmp_fds = *rdfs;
int ret = select(max_fd, &tmp_fds, NULL, NULL, NULL);
if (ret == -1) {
perror("select");
break;
}

if (FD_ISSET(*timer_fd, &tmp_fds)) {
// タイマーイベントの処理
uint64_t expirations;
if (read(*timer_fd, &expirations, sizeof(expirations)) == -1) {
perror("read");
} else {
count_down(p_info);
}
}

if (FD_ISSET(*inotify_fd, &tmp_fds)) {
//変更イベントを読み取る。readを使うことで一度に読み取り
int length = read(*inotify_fd, buffer, EVENT_BUF_LEN); //lengthはバイト数が入る。readで一度に読み取り
if (length < 0) {
perror("QM: read event");
exit(EXIT_FAILURE);
}
//count++;

//読み込んだ変更イベントを1つずつ処理する
// event_point : 変更内容を順に取得するために使用.event毎の先頭アドレスを指す
int event_point = 0;
while (event_point < length) {
struct inotify_event *event = (struct inotify_event *) &buffer[event_point]; //キャストすることで、それぞれのイベントの先頭アドレスを指定
// 変更のみ対応
if (event->mask & IN_MODIFY) {
// 変更されたファイルを探す
for(int i = 0; i< RTI_federate_nodes; i++) {
if(event->wd == wd[i]) {
p_info[i].fd = fopen(p_info[i].file_path, "r+");
if (!p_info[i].fd) {
perror("QM: Error opening file");
continue;
}

while (flock(fileno(p_info[i].fd), LOCK_EX) == -1) { // 排他ロックを取得
perror("QM: Failed to lock file");
usleep(1000); // 待機してリトライ
}

int last_line = 0;
while (fgets(line, sizeof(line), p_info[i].fd) != NULL) {
last_line = 1;
sscanf(line, "cp: %s", p_info[i].cp_num);
printf("QM: CP_num %s\n", p_info[i].cp_num);

//CP受信による実行時間監視の開始
time_count_update(&p_info[i]);
//実行デバック
int cp_num_value = atoi(p_info[i].cp_num);
printf("QM: updated count %d\n", p_info[i].cp_array[cp_num_value]->timer_count);
}

if (last_line) {
int fd = fileno(p_info[i].fd);
if (ftruncate(fd, 0) != 0) {
perror("Failed to truncate file\n");
}
rewind(p_info[i].fd); // ファイルポインタを先頭に戻す
}

fclose(p_info[i].fd);
}
}
event_point += EVENT_SIZE + event->len;
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error handling for read and fgets failures and use configuration for buffer sizes.

The function lacks error handling for read and fgets failures and uses hardcoded buffer sizes. Consider adding error handling and using configuration or arguments for buffer sizes.

-            while (fgets(line, sizeof(line), p_info[i].fd) != NULL) {
+            while (fgets(line, CONFIG_LINE_BUFFER_SIZE, p_info[i].fd) != NULL) {
+                if (ferror(p_info[i].fd)) {
+                    perror("QM: Error reading file");
+                    break;
+                }

Committable suggestion was skipped due to low confidence.

Comment on lines 81 to 102
void count_down(process_info *p_info) {
//sudoでkillする.system()を用いる
for(int i =0; i<RTI_federate_nodes; i++) {
for(int j = 0; j<max_cp_num; j++) {
if(p_info[i].cp_array[j]->check_do == true) {
p_info[i].cp_array[j]->timer_count--;
if(p_info[i].cp_array[j]->timer_count == 0) {
char cmd[50];
sprintf(cmd, "sudo kill %d", p_info[i].pid);
printf("will kill PID: %d\n", p_info[i].pid);

int result = system(cmd);
if(result == -1) {
perror("system kill");
} else {
printf("QM: kill success\n");
}
}
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use kill instead of system for better security and add error handling for invalid pid.

Using system to execute the kill command can be a security risk. It's better to use the kill function directly. Also, add error handling for invalid pid.

-                    char cmd[50];
-                    sprintf(cmd, "sudo kill %d", p_info[i].pid);
-                    printf("will kill PID: %d\n", p_info[i].pid);
-                    int result = system(cmd);
-                    if(result == -1) {
-                        perror("system kill");
-                    } else {
-                        printf("QM: kill success\n");
-                    }
+                    if (p_info[i].pid > 0) {
+                        if (kill(p_info[i].pid, SIGKILL) == -1) {
+                            perror("kill");
+                        } else {
+                            printf("QM: kill success\n");
+                        }
+                    } else {
+                        fprintf(stderr, "Invalid PID: %d\n", p_info[i].pid);
+                    }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
void count_down(process_info *p_info) {
//sudoでkillする.system()を用いる
for(int i =0; i<RTI_federate_nodes; i++) {
for(int j = 0; j<max_cp_num; j++) {
if(p_info[i].cp_array[j]->check_do == true) {
p_info[i].cp_array[j]->timer_count--;
if(p_info[i].cp_array[j]->timer_count == 0) {
char cmd[50];
sprintf(cmd, "sudo kill %d", p_info[i].pid);
printf("will kill PID: %d\n", p_info[i].pid);
int result = system(cmd);
if(result == -1) {
perror("system kill");
} else {
printf("QM: kill success\n");
}
}
}
}
}
}
void count_down(process_info *p_info) {
//sudoでkillする.system()を用いる
for(int i =0; i<RTI_federate_nodes; i++) {
for(int j = 0; j<max_cp_num; j++) {
if(p_info[i].cp_array[j]->check_do == true) {
p_info[i].cp_array[j]->timer_count--;
if(p_info[i].cp_array[j]->timer_count == 0) {
if (p_info[i].pid > 0) {
if (kill(p_info[i].pid, SIGKILL) == -1) {
perror("kill");
} else {
printf("QM: kill success\n");
}
} else {
fprintf(stderr, "Invalid PID: %d\n", p_info[i].pid);
}
}
}
}
}
}

Comment on lines 63 to 76
void time_count_update(process_info *p_info) {
int cp_num_value = atoi(p_info -> cp_num);

if(p_info->cp_array[cp_num_value]->end_cp == true) {
p_info->cp_array[cp_num_value - 1]->check_do = false;
} else if(p_info->cp_array[cp_num_value]->start_cp == true) {
p_info->cp_array[cp_num_value]->timer_count = p_info->deadline[cp_num_value];
p_info->cp_array[cp_num_value]->check_do = true;
} else {
p_info->cp_array[cp_num_value]->timer_count = p_info->deadline[cp_num_value];
p_info->cp_array[cp_num_value]->check_do = true;
p_info->cp_array[cp_num_value - 1]->check_do = false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error handling for invalid checkpoint numbers.

The function does not handle the case where cp_num_value is out of bounds for cp_array.

+    if (cp_num_value < 0 || cp_num_value >= max_cp_num) {
+        fprintf(stderr, "Invalid checkpoint number: %d\n", cp_num_value);
+        return;
+    }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
void time_count_update(process_info *p_info) {
int cp_num_value = atoi(p_info -> cp_num);
if(p_info->cp_array[cp_num_value]->end_cp == true) {
p_info->cp_array[cp_num_value - 1]->check_do = false;
} else if(p_info->cp_array[cp_num_value]->start_cp == true) {
p_info->cp_array[cp_num_value]->timer_count = p_info->deadline[cp_num_value];
p_info->cp_array[cp_num_value]->check_do = true;
} else {
p_info->cp_array[cp_num_value]->timer_count = p_info->deadline[cp_num_value];
p_info->cp_array[cp_num_value]->check_do = true;
p_info->cp_array[cp_num_value - 1]->check_do = false;
}
}
void time_count_update(process_info *p_info) {
int cp_num_value = atoi(p_info -> cp_num);
if (cp_num_value < 0 || cp_num_value >= max_cp_num) {
fprintf(stderr, "Invalid checkpoint number: %d\n", cp_num_value);
return;
}
if(p_info->cp_array[cp_num_value]->end_cp == true) {
p_info->cp_array[cp_num_value - 1]->check_do = false;
} else if(p_info->cp_array[cp_num_value]->start_cp == true) {
p_info->cp_array[cp_num_value]->timer_count = p_info->deadline[cp_num_value];
p_info->cp_array[cp_num_value]->check_do = true;
} else {
p_info->cp_array[cp_num_value]->timer_count = p_info->deadline[cp_num_value];
p_info->cp_array[cp_num_value]->check_do = true;
p_info->cp_array[cp_num_value - 1]->check_do = false;
}
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 51a2c1a and d6eb876.

Files selected for processing (1)
  • Monitoring_ver4.c (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • Monitoring_ver4.c

@lhstrh
Copy link
Member

lhstrh commented Jul 25, 2024

Hi @YoshinoriTerazawa, could you please provide some context for this pull request? The AI-generated summary is somewhat helpful, but it would be nice to better understand your goal.

@YoshinoriTerazawa
Copy link
Author

YoshinoriTerazawa commented Jul 26, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants