@cryptotaxi247 / netdata-1 / commits / fe97f0996

more appropriate heardbeat error message

Costa Tsaousis (ktsaou) committed Apr 21, 2017 at 22:09 UTC fe97f0996de5a4f8c4c416871cba279ab81be297
2 files changed +20 -21
src/apps_plugin.c
+18 -19
@@ -2878,24 +2878,24 @@ static void normalize_utilization(struct target *root) {
2878 }
2879 #endif // ALL_PIDS_ARE_READ_INSTANTLY
2880
2881 -static void send_collected_data_to_netdata(struct target *root, const char *type, usec_t usec) {
2881 +static void send_collected_data_to_netdata(struct target *root, const char *type, usec_t dt) {
2882 struct target *w;
2883
2884 - send_BEGIN(type, "cpu", usec);
2884 + send_BEGIN(type, "cpu", dt);
2885 for (w = root; w ; w = w->next) {
2886 if(unlikely(w->exposed))
2887 send_SET(w->name, (kernel_uint_t)(w->utime * utime_fix_ratio) + (kernel_uint_t)(w->stime * stime_fix_ratio) + (kernel_uint_t)(w->gtime * gtime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cutime * cutime_fix_ratio) + (kernel_uint_t)(w->cstime * cstime_fix_ratio) + (kernel_uint_t)(w->cgtime * cgtime_fix_ratio)):0ULL));
2888 }
2889 send_END();
2890
2891 - send_BEGIN(type, "cpu_user", usec);
2891 + send_BEGIN(type, "cpu_user", dt);
2892 for (w = root; w ; w = w->next) {
2893 if(unlikely(w->exposed))
2894 send_SET(w->name, (kernel_uint_t)(w->utime * utime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cutime * cutime_fix_ratio)):0ULL));
2895 }
2896 send_END();
2897
2898 - send_BEGIN(type, "cpu_system", usec);
2898 + send_BEGIN(type, "cpu_system", dt);
2899 for (w = root; w ; w = w->next) {
2900 if(unlikely(w->exposed))
2901 send_SET(w->name, (kernel_uint_t)(w->stime * stime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cstime * cstime_fix_ratio)):0ULL));
@@ -2903,7 +2903,7 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
2903 send_END();
2904
2905 if(show_guest_time) {
2906 - send_BEGIN(type, "cpu_guest", usec);
2906 + send_BEGIN(type, "cpu_guest", dt);
2907 for (w = root; w ; w = w->next) {
2908 if(unlikely(w->exposed))
2909 send_SET(w->name, (kernel_uint_t)(w->gtime * gtime_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cgtime * cgtime_fix_ratio)):0ULL));
@@ -2911,42 +2911,42 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
2911 send_END();
2912 }
2913
2914 - send_BEGIN(type, "threads", usec);
2914 + send_BEGIN(type, "threads", dt);
2915 for (w = root; w ; w = w->next) {
2916 if(unlikely(w->exposed))
2917 send_SET(w->name, w->num_threads);
2918 }
2919 send_END();
2920
2921 - send_BEGIN(type, "processes", usec);
2921 + send_BEGIN(type, "processes", dt);
2922 for (w = root; w ; w = w->next) {
2923 if(unlikely(w->exposed))
2924 send_SET(w->name, w->processes);
2925 }
2926 send_END();
2927
2928 - send_BEGIN(type, "mem", usec);
2928 + send_BEGIN(type, "mem", dt);
2929 for (w = root; w ; w = w->next) {
2930 if(unlikely(w->exposed))
2931 send_SET(w->name, (w->statm_resident > w->statm_share)?(w->statm_resident - w->statm_share):0ULL);
2932 }
2933 send_END();
2934
2935 - send_BEGIN(type, "vmem", usec);
2935 + send_BEGIN(type, "vmem", dt);
2936 for (w = root; w ; w = w->next) {
2937 if(unlikely(w->exposed))
2938 send_SET(w->name, w->statm_size);
2939 }
2940 send_END();
2941
2942 - send_BEGIN(type, "minor_faults", usec);
2942 + send_BEGIN(type, "minor_faults", dt);
2943 for (w = root; w ; w = w->next) {
2944 if(unlikely(w->exposed))
2945 send_SET(w->name, (kernel_uint_t)(w->minflt * minflt_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cminflt * cminflt_fix_ratio)):0ULL));
2946 }
2947 send_END();
2948
2949 - send_BEGIN(type, "major_faults", usec);
2949 + send_BEGIN(type, "major_faults", dt);
2950 for (w = root; w ; w = w->next) {
2951 if(unlikely(w->exposed))
2952 send_SET(w->name, (kernel_uint_t)(w->majflt * majflt_fix_ratio) + (include_exited_childs?((kernel_uint_t)(w->cmajflt * cmajflt_fix_ratio)):0ULL));
@@ -2954,14 +2954,14 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
2954 send_END();
2955
2956 #ifndef __FreeBSD__
2957 - send_BEGIN(type, "lreads", usec);
2957 + send_BEGIN(type, "lreads", dt);
2958 for (w = root; w ; w = w->next) {
2959 if(unlikely(w->exposed))
2960 send_SET(w->name, w->io_logical_bytes_read);
2961 }
2962 send_END();
2963
2964 - send_BEGIN(type, "lwrites", usec);
2964 + send_BEGIN(type, "lwrites", dt);
2965 for (w = root; w ; w = w->next) {
2966 if(unlikely(w->exposed))
2967 send_SET(w->name, w->io_logical_bytes_written);
@@ -2969,14 +2969,14 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
2969 send_END();
2970 #endif
2971
2972 - send_BEGIN(type, "preads", usec);
2972 + send_BEGIN(type, "preads", dt);
2973 for (w = root; w ; w = w->next) {
2974 if(unlikely(w->exposed))
2975 send_SET(w->name, w->io_storage_bytes_read);
2976 }
2977 send_END();
2978
2979 - send_BEGIN(type, "pwrites", usec);
2979 + send_BEGIN(type, "pwrites", dt);
2980 for (w = root; w ; w = w->next) {
2981 if(unlikely(w->exposed))
2982 send_SET(w->name, w->io_storage_bytes_written);
@@ -2984,21 +2984,21 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
2984 send_END();
2985
2986 if(enable_file_charts) {
2987 - send_BEGIN(type, "files", usec);
2987 + send_BEGIN(type, "files", dt);
2988 for (w = root; w; w = w->next) {
2989 if (unlikely(w->exposed))
2990 send_SET(w->name, w->openfiles);
2991 }
2992 send_END();
2993
2994 - send_BEGIN(type, "sockets", usec);
2994 + send_BEGIN(type, "sockets", dt);
2995 for (w = root; w; w = w->next) {
2996 if (unlikely(w->exposed))
2997 send_SET(w->name, w->opensockets);
2998 }
2999 send_END();
3000
3001 - send_BEGIN(type, "pipes", usec);
3001 + send_BEGIN(type, "pipes", dt);
3002 for (w = root; w; w = w->next) {
3003 if (unlikely(w->exposed))
3004 send_SET(w->name, w->openpipes);
@@ -3469,7 +3469,6 @@ int main(int argc, char **argv) {
3469 normalize_utilization(apps_groups_root_target);
3470
3471 send_resource_usage_to_netdata(dt);
3472 - if(global_iterations_counter == 1) dt = 0;
3472
3473 // this is smart enough to show only newly added apps, when needed
3474 send_charts_updates_to_netdata(apps_groups_root_target, "apps", "Apps");
src/clocks.c
+2 -2
@@ -115,8 +115,8 @@ usec_t heartbeat_next(heartbeat_t *hb, usec_t tick)
115 if(likely(*hb != 0ULL)) {
116 usec_t dt = now - *hb;
117 *hb = now;
118 - if(unlikely(dt / tick > 1))
119 - error("heartbeat missed between %llu usec and %llu usec", *hb, now);
118 + if(unlikely(dt >= tick + tick / 2))
119 + error("heartbeat missed %llu microseconds", dt - tick);
120 return dt;
121 }
122 else {