Skip to content

Commit

Permalink
in_cpu: prinf info about PID being monitored
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Nov 6, 2024
1 parent f55e027 commit 40cbc33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/in_cpu/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,15 @@ static int cb_cpu_init(struct flb_input_instance *in,
int ret;
struct flb_cpu *ctx;
(void) data;

/* Allocate space for the configuration */
ctx = flb_calloc(1, sizeof(struct flb_cpu));
if (!ctx) {
flb_errno();
return -1;
}
ctx->ins = in;

ret = flb_input_config_map_set(in, (void *)ctx);
if (ret == -1) {
flb_free(ctx);
Expand Down Expand Up @@ -559,6 +559,7 @@ static int cb_cpu_init(struct flb_input_instance *in,
/* Get CPU load, ready to be updated once fired the calc callback */
if (ctx->pid > 0) {
ret = proc_cpu_pid_load(ctx, ctx->pid, &ctx->cstats);
flb_plg_info(in, "monitoring PID %i", ctx->pid);
}
else {
ret = proc_cpu_load(ctx->n_processors, &ctx->cstats);
Expand Down

0 comments on commit 40cbc33

Please sign in to comment.