@cryptotaxi247 / netdata-1 / commits / 70d645fd7

allow debug logs of individual targets to be printed

Costa Tsaousis (ktsaou) committed Apr 17, 2018 at 23:07 UTC 70d645fd771acaa88749c3a001885ca46d33d1e4
1 file changed +9 -9
src/apps_plugin.c
+9 -9
@@ -807,7 +807,7 @@ static inline void assign_target_to_pid(struct pid_stat *p) {
807
808 struct target *w;
809 for(w = apps_groups_root_target; w ; w = w->next) {
810 - // if(debug_enabled || (p->target && p->target->debug_enabled)) debug_log("\t\tcomparing '%s' with '%s'", w->compare, p->comm);
810 + // if(debug_enabled || (p->target && p->target->debug_enabled)) debug_log_int("\t\tcomparing '%s' with '%s'", w->compare, p->comm);
811
812 // find it - 4 cases:
813 // 1. the target is not a pattern
@@ -825,7 +825,7 @@ static inline void assign_target_to_pid(struct pid_stat *p) {
825 else p->target = w;
826
827 if(debug_enabled || (p->target && p->target->debug_enabled))
828 - debug_log("%s linked to target %s", p->comm, p->target->name);
828 + debug_log_int("%s linked to target %s", p->comm, p->target->name);
829
830 break;
831 }
@@ -1180,7 +1180,7 @@ static inline int read_proc_pid_stat(struct pid_stat *p, void *ptr) {
1180 #endif
1181
1182 if(unlikely(debug_enabled || (p->target && p->target->debug_enabled)))
1183 - debug_log("READ PROC/PID/STAT: %s/proc/%d/stat, process: '%s' on target '%s' (dt=%llu) VALUES: utime=" KERNEL_UINT_FORMAT ", stime=" KERNEL_UINT_FORMAT ", cutime=" KERNEL_UINT_FORMAT ", cstime=" KERNEL_UINT_FORMAT ", minflt=" KERNEL_UINT_FORMAT ", majflt=" KERNEL_UINT_FORMAT ", cminflt=" KERNEL_UINT_FORMAT ", cmajflt=" KERNEL_UINT_FORMAT ", threads=%d", netdata_configured_host_prefix, p->pid, p->comm, (p->target)?p->target->name:"UNSET", p->stat_collected_usec - p->last_stat_collected_usec, p->utime, p->stime, p->cutime, p->cstime, p->minflt, p->majflt, p->cminflt, p->cmajflt, p->num_threads);
1183 + debug_log_int("READ PROC/PID/STAT: %s/proc/%d/stat, process: '%s' on target '%s' (dt=%llu) VALUES: utime=" KERNEL_UINT_FORMAT ", stime=" KERNEL_UINT_FORMAT ", cutime=" KERNEL_UINT_FORMAT ", cstime=" KERNEL_UINT_FORMAT ", minflt=" KERNEL_UINT_FORMAT ", majflt=" KERNEL_UINT_FORMAT ", cminflt=" KERNEL_UINT_FORMAT ", cmajflt=" KERNEL_UINT_FORMAT ", threads=%d", netdata_configured_host_prefix, p->pid, p->comm, (p->target)?p->target->name:"UNSET", p->stat_collected_usec - p->last_stat_collected_usec, p->utime, p->stime, p->cutime, p->cstime, p->minflt, p->majflt, p->cminflt, p->cmajflt, p->num_threads);
1184
1185 if(unlikely(global_iterations_counter == 1)) {
1186 p->minflt = 0;
@@ -2058,7 +2058,7 @@ static inline void link_all_processes_to_their_parents(void) {
2058 pp->children_count++;
2059
2060 if(unlikely(debug_enabled || (p->target && p->target->debug_enabled)))
2061 - debug_log("child %d (%s, %s) on target '%s' has parent %d (%s, %s). Parent: utime=" KERNEL_UINT_FORMAT ", stime=" KERNEL_UINT_FORMAT ", gtime=" KERNEL_UINT_FORMAT ", minflt=" KERNEL_UINT_FORMAT ", majflt=" KERNEL_UINT_FORMAT ", cutime=" KERNEL_UINT_FORMAT ", cstime=" KERNEL_UINT_FORMAT ", cgtime=" KERNEL_UINT_FORMAT ", cminflt=" KERNEL_UINT_FORMAT ", cmajflt=" KERNEL_UINT_FORMAT "", p->pid, p->comm, p->updated?"running":"exited", (p->target)?p->target->name:"UNSET", pp->pid, pp->comm, pp->updated?"running":"exited", pp->utime, pp->stime, pp->gtime, pp->minflt, pp->majflt, pp->cutime, pp->cstime, pp->cgtime, pp->cminflt, pp->cmajflt);
2061 + debug_log_int("child %d (%s, %s) on target '%s' has parent %d (%s, %s). Parent: utime=" KERNEL_UINT_FORMAT ", stime=" KERNEL_UINT_FORMAT ", gtime=" KERNEL_UINT_FORMAT ", minflt=" KERNEL_UINT_FORMAT ", majflt=" KERNEL_UINT_FORMAT ", cutime=" KERNEL_UINT_FORMAT ", cstime=" KERNEL_UINT_FORMAT ", cgtime=" KERNEL_UINT_FORMAT ", cminflt=" KERNEL_UINT_FORMAT ", cmajflt=" KERNEL_UINT_FORMAT "", p->pid, p->comm, p->updated?"running":"exited", (p->target)?p->target->name:"UNSET", pp->pid, pp->comm, pp->updated?"running":"exited", pp->utime, pp->stime, pp->gtime, pp->minflt, pp->majflt, pp->cutime, pp->cstime, pp->cgtime, pp->cminflt, pp->cmajflt);
2062 }
2063 else {
2064 p->parent = NULL;
@@ -2350,7 +2350,7 @@ static void apply_apps_groups_targets_inheritance(void) {
2350 found++;
2351
2352 if(debug_enabled || (p->target && p->target->debug_enabled))
2353 - debug_log("TARGET INHERITANCE: %s is inherited by %d (%s) from its parent %d (%s).", p->target->name, p->pid, p->comm, p->parent->pid, p->parent->comm);
2353 + debug_log_int("TARGET INHERITANCE: %s is inherited by %d (%s) from its parent %d (%s).", p->target->name, p->pid, p->comm, p->parent->pid, p->parent->comm);
2354 }
2355 }
2356 }
@@ -2386,7 +2386,7 @@ static void apply_apps_groups_targets_inheritance(void) {
2386 p->parent->target = p->target;
2387
2388 if(debug_enabled || (p->target && p->target->debug_enabled))
2389 - debug_log("TARGET INHERITANCE: %s is inherited by %d (%s) from its child %d (%s).", p->target->name, p->parent->pid, p->parent->comm, p->pid, p->comm);
2389 + debug_log_int("TARGET INHERITANCE: %s is inherited by %d (%s) from its child %d (%s).", p->target->name, p->parent->pid, p->parent->comm, p->pid, p->comm);
2390 }
2391
2392 found++;
@@ -2431,7 +2431,7 @@ static void apply_apps_groups_targets_inheritance(void) {
2431 found++;
2432
2433 if(debug_enabled || (p->target && p->target->debug_enabled))
2434 - debug_log("TARGET INHERITANCE: %s is inherited by %d (%s) from its parent %d (%s) at phase 2.", p->target->name, p->pid, p->comm, p->parent->pid, p->parent->comm);
2434 + debug_log_int("TARGET INHERITANCE: %s is inherited by %d (%s) from its parent %d (%s) at phase 2.", p->target->name, p->pid, p->comm, p->parent->pid, p->parent->comm);
2435 }
2436 }
2437 }
@@ -2630,7 +2630,7 @@ static inline void aggregate_pid_on_target(struct target *w, struct pid_stat *p,
2630 w->num_threads += p->num_threads;
2631
2632 if(unlikely(debug_enabled || w->debug_enabled))
2633 - debug_log("aggregating '%s' pid %d on target '%s' utime=" KERNEL_UINT_FORMAT ", stime=" KERNEL_UINT_FORMAT ", gtime=" KERNEL_UINT_FORMAT ", cutime=" KERNEL_UINT_FORMAT ", cstime=" KERNEL_UINT_FORMAT ", cgtime=" KERNEL_UINT_FORMAT ", minflt=" KERNEL_UINT_FORMAT ", majflt=" KERNEL_UINT_FORMAT ", cminflt=" KERNEL_UINT_FORMAT ", cmajflt=" KERNEL_UINT_FORMAT "", p->comm, p->pid, w->name, p->utime, p->stime, p->gtime, p->cutime, p->cstime, p->cgtime, p->minflt, p->majflt, p->cminflt, p->cmajflt);
2633 + debug_log_int("aggregating '%s' pid %d on target '%s' utime=" KERNEL_UINT_FORMAT ", stime=" KERNEL_UINT_FORMAT ", gtime=" KERNEL_UINT_FORMAT ", cutime=" KERNEL_UINT_FORMAT ", cstime=" KERNEL_UINT_FORMAT ", cgtime=" KERNEL_UINT_FORMAT ", minflt=" KERNEL_UINT_FORMAT ", majflt=" KERNEL_UINT_FORMAT ", cminflt=" KERNEL_UINT_FORMAT ", cmajflt=" KERNEL_UINT_FORMAT "", p->comm, p->pid, w->name, p->utime, p->stime, p->gtime, p->cutime, p->cstime, p->cgtime, p->minflt, p->majflt, p->cminflt, p->cmajflt);
2634 }
2635
2636 static void calculate_netdata_statistics(void) {
@@ -3150,7 +3150,7 @@ static void send_charts_updates_to_netdata(struct target *root, const char *type
3150 newly_added++;
3151 w->exposed = 1;
3152 if (debug_enabled || w->debug_enabled)
3153 - debug_log("%s just added - regenerating charts.", w->name);
3153 + debug_log_int("%s just added - regenerating charts.", w->name);
3154 }
3155 }
3156