lowered memory requirements even more, by using config strings in-place; probably fixes an issue in charts panning; made startup script read the web directory from the config
Costa Tsaousis (ktsaou) committed
May 1, 2014 at 20:50 UTC
237ff7a5e40393669289dffad29caadae564d72f
3 files changed
+164
-103
netdata.c
+142
-92
@@ -365,8 +365,9 @@ struct config_value {
365
unsigned long hash; // a simple hash to speed up searching
366
// we first compare hashes, and only if the hashes are equal we do string comparisons
367
368
- int used;
369
- int changed;
368
+ int loaded; // loaded from the user config
369
+ int used; // has been accessed from the program
370
+ int changed; // changed from the internal default
371
372
struct config_value *next;
373
};
@@ -537,6 +538,7 @@ int load_config(char *filename, int overwrite_used)
538
else
539
debug(D_CONFIG, "Ignoring line %d, '%s/%s' is already present and used.", line, co->name, cv->name);
540
}
541
+ cv->loaded = 1;
542
}
543
544
fclose(fp);
@@ -565,7 +567,16 @@ char *config_get(const char *section, const char *name, const char *default_valu
567
if(!cv) cv = config_value_create(co, name, default_value);
568
cv->used = 1;
569
568
- if(strcmp(cv->value, default_value) != 0) cv->changed = 1;
570
+ if(cv->loaded) {
571
+ // this is a loaded value from the config file
572
+ // if it is different that the default, mark it
573
+ if(strcmp(cv->value, default_value) != 0) cv->changed = 1;
574
+ }
575
+ else {
576
+ // this is not loaded from the config
577
+ // copy the default value to it
578
+ strncpy(cv->value, default_value, CONFIG_MAX_VALUE);
579
+ }
580
581
pthread_mutex_unlock(&config_mutex);
582
return(cv->value);
@@ -598,7 +609,7 @@ int config_get_boolean(const char *section, const char *name, int value)
609
}
610
}
611
601
-void config_set(const char *section, const char *name, char *value)
612
+const char *config_set(const char *section, const char *name, const char *value)
613
{
614
struct config_value *cv;
615
@@ -617,29 +628,36 @@ void config_set(const char *section, const char *name, char *value)
628
629
if(!cv) cv = config_value_create(co, name, value);
630
cv->used = 1;
620
- cv->changed = 1;
631
+
632
+ if(strcmp(cv->value, value) != 0) cv->changed = 1;
633
634
strncpy(cv->value, value, CONFIG_MAX_VALUE);
635
// termination is already there
636
637
pthread_mutex_unlock(&config_mutex);
638
+
639
+ return value;
640
}
641
628
-void config_set_number(const char *section, const char *name, long long value)
642
+long long config_set_number(const char *section, const char *name, long long value)
643
{
644
char buffer[100];
645
sprintf(buffer, "%lld", value);
646
647
config_set(section, name, buffer);
648
+
649
+ return value;
650
}
651
636
-void config_set_boolean(const char *section, const char *name, int value)
652
+int config_set_boolean(const char *section, const char *name, int value)
653
{
654
char *s;
655
if(value) s = "yes";
656
else s = "no";
657
658
config_set(section, name, s);
659
+
660
+ return value;
661
}
662
663
@@ -753,7 +771,7 @@ typedef uint32_t ustorage_number;
771
772
struct rrd_dimension {
773
char id[RRD_STATS_NAME_MAX + 1]; // the id of this dimension (for internal identification)
756
- char name[RRD_STATS_NAME_MAX + 1]; // the name of this dimension (as presented to user)
774
+ char *name; // the name of this dimension (as presented to user)
775
776
unsigned long hash; // a simple hash on the id, to speed up searching
777
// we first compare hashes, and only if the hashes are equal we do string comparisons
@@ -787,19 +805,17 @@ struct rrd_stats {
805
unsigned long counter; // the number of times we added values to this rrd
806
807
char id[RRD_STATS_NAME_MAX + 1]; // id of the data set
790
- char name[RRD_STATS_NAME_MAX + 1]; // name of the data set
808
+ char *name; // name of the data set
809
810
unsigned long hash; // a simple hash on the id, to speed up searching
811
// we first compare hashes, and only if the hashes are equal we do string comparisons
812
795
- char type[RRD_STATS_NAME_MAX + 1]; // the type of graph RRD_TYPE_* (a category, for determining graphing options)
796
- char family[RRD_STATS_NAME_MAX + 1]; // the family of this data set (for grouping them together)
797
-
798
- char title[RRD_STATS_NAME_MAX + 1]; // title shown to user
799
- char units[RRD_STATS_NAME_MAX + 1]; // units of measurement
813
+ char *type; // the type of graph RRD_TYPE_* (a category, for determining graphing options)
814
+ char *family; // the family of this data set (for grouping them together)
815
+ char *title; // title shown to user
816
+ char *units; // units of measurement
817
801
- char usertitle[RRD_STATS_NAME_MAX + 1];
802
- long userpriority;
818
+ long priority;
819
820
long entries; // total number of entries in the data set
821
long current_entry; // the entry that is currently being updated
@@ -832,7 +848,6 @@ pthread_mutex_t root_mutex = PTHREAD_MUTEX_INITIALIZER;
848
RRD_STATS *rrd_stats_create(const char *type, const char *id, const char *name, const char *family, const char *title, const char *units, long priority, int update_every, int chart_type)
849
{
850
RRD_STATS *st = NULL;
835
- char *p;
851
852
if(!id || !id[0]) {
853
fatal("Cannot create rrd stats without an id.");
@@ -849,50 +864,35 @@ RRD_STATS *rrd_stats_create(const char *type, const char *id, const char *name,
864
865
// no need to terminate the strings after strncpy(), because of calloc()
866
852
- strncpy(st->id, type, RRD_STATS_NAME_MAX-1);
853
- strcat(st->id, ".");
854
- int len = strlen(st->id);
855
- strncpy(&st->id[len], id, RRD_STATS_NAME_MAX - len);
867
+ snprintf(st->id, RRD_STATS_NAME_MAX, "%s.%s", type, id);
868
st->hash = simple_hash(st->id);
869
870
if(name) {
859
- strncpy(st->name, type, RRD_STATS_NAME_MAX - 1);
860
- strcat(st->name, ".");
861
- len = strlen(st->name);
862
- strncpy(&st->name[len], name, RRD_STATS_NAME_MAX - len);
871
+ char varvalue[CONFIG_MAX_VALUE + 1];
872
+ snprintf(varvalue, CONFIG_MAX_VALUE, "%s.%s", type?type:"", name);
873
+ st->name = config_get(st->id, "name", varvalue);
874
}
864
- else strcpy(st->name, st->id);
865
-
866
- // replace illegal characters in name
867
- while((p = strchr(st->name, ' '))) *p = '_';
868
- while((p = strchr(st->name, '/'))) *p = '_';
869
- while((p = strchr(st->name, '?'))) *p = '_';
870
- while((p = strchr(st->name, '&'))) *p = '_';
871
-
872
- if(family) strncpy(st->family, family, RRD_STATS_NAME_MAX);
873
- else strcpy(st->family, st->id);
874
-
875
- strncpy(st->title, title, RRD_STATS_NAME_MAX);
876
- strncpy(st->units, units, RRD_STATS_NAME_MAX);
877
- strncpy(st->type, type, RRD_STATS_NAME_MAX);
875
+ else st->name = config_get(st->id, "name", st->id);
876
879
- snprintf(st->usertitle, RRD_STATS_NAME_MAX, "%s (%s)", st->title, st->name);
880
- strncpy(st->usertitle, config_get(st->id, "title", st->usertitle), RRD_STATS_NAME_MAX);
877
+ {
878
+ char varvalue[CONFIG_MAX_VALUE + 1];
879
+ snprintf(varvalue, CONFIG_MAX_VALUE, "%s (%s)", title?title:"", st->name);
880
+ st->title = config_get(st->id, "title", varvalue);
881
+ }
882
883
+ st->family = config_get(st->id, "family", family?family:st->id);
884
+ st->units = config_get(st->id, "units", units?units:"");
885
+ st->type = config_get(st->id, "type", type?type:"");
886
st->chart_type = chart_type_id(config_get(st->id, "chart type", chart_type_name(chart_type)));
887
884
- p = config_get(st->id, "history", "default");
885
- st->entries = strtoul(p, NULL, 0);
886
- if(strcmp(p, "default") == 0) st->entries = save_history;
887
- if(st->entries < 5) st->entries = 5;
888
- if(st->entries > HISTORY_MAX) st->entries = HISTORY_MAX;
888
+ st->entries = config_get_number(st->id, "history", save_history);
889
+ if(st->entries < 5) st->entries = config_set_number(st->id, "history", 5);
890
+ if(st->entries > HISTORY_MAX) st->entries = config_set_number(st->id, "history", HISTORY_MAX);
891
890
- st->userpriority = config_get_number(st->id, "priority", priority);
892
+ st->priority = config_get_number(st->id, "priority", priority);
893
st->enabled = config_get_boolean(st->id, "enabled", 1);
894
if(!st->enabled) st->entries = 5;
895
894
- st->debug = config_get_boolean(st->id, "debug", 0);
895
-
896
st->timediff = calloc(st->entries, sizeof(uint32_t));
897
if(!st->timediff) {
898
free(st);
@@ -915,8 +915,15 @@ RRD_STATS *rrd_stats_create(const char *type, const char *id, const char *name,
915
return(st);
916
}
917
918
+void rrd_stats_set_name(RRD_STATS *st, const char *name)
919
+{
920
+ config_get(st->id, "name", name);
921
+}
922
+
923
+
924
RRD_DIMENSION *rrd_stats_dimension_add(RRD_STATS *st, const char *id, const char *name, long multiplier, long divisor, int algorithm)
925
{
926
+ char varname[CONFIG_MAX_NAME + 1];
927
RRD_DIMENSION *rd = NULL;
928
929
debug(D_RRD_STATS, "Adding dimension '%s/%s'.", st->id, id);
@@ -927,25 +934,23 @@ RRD_DIMENSION *rrd_stats_dimension_add(RRD_STATS *st, const char *id, const char
934
return NULL;
935
}
936
930
- char varname[RRD_STATS_NAME_MAX + 1];
937
+ strncpy(rd->id, id, RRD_STATS_NAME_MAX);
938
+ rd->hash = simple_hash(rd->id);
939
932
- snprintf(varname, RRD_STATS_NAME_MAX, "dim %s name", id);
933
- name = config_get(st->id, varname, name?name:id);
940
+ snprintf(varname, CONFIG_MAX_NAME, "dim %s name", rd->id);
941
+ rd->name = config_get(st->id, varname, name?name:rd->id);
942
935
- snprintf(varname, RRD_STATS_NAME_MAX, "dim %s algorithm", id);
936
- algorithm = algorithm_id(config_get(st->id, varname, algorithm_name(algorithm)));
943
+ snprintf(varname, CONFIG_MAX_NAME, "dim %s algorithm", rd->id);
944
+ rd->algorithm = algorithm_id(config_get(st->id, varname, algorithm_name(algorithm)));
945
938
- snprintf(varname, RRD_STATS_NAME_MAX, "dim %s multiplier", id);
939
- multiplier = config_get_number(st->id, varname, multiplier);
946
+ snprintf(varname, CONFIG_MAX_NAME, "dim %s multiplier", rd->id);
947
+ rd->multiplier = config_get_number(st->id, varname, multiplier);
948
941
- snprintf(varname, RRD_STATS_NAME_MAX, "dim %s divisor", id);
942
- divisor = config_get_number(st->id, varname, divisor);
949
+ snprintf(varname, CONFIG_MAX_NAME, "dim %s divisor", rd->id);
950
+ rd->divisor = config_get_number(st->id, varname, divisor);
951
952
rd->entries = st->entries;
945
- rd->multiplier = multiplier;
946
- rd->divisor = divisor;
947
- rd->algorithm = algorithm;
948
-
953
+
954
rd->values = calloc(rd->entries, sizeof(storage_number));
955
if(!rd->values) {
956
free(rd);
@@ -953,14 +958,6 @@ RRD_DIMENSION *rrd_stats_dimension_add(RRD_STATS *st, const char *id, const char
958
return NULL;
959
}
960
956
- // no need to terminate the strings after strncpy(), because of calloc()
957
-
958
- strncpy(rd->id, id, RRD_STATS_NAME_MAX);
959
- rd->hash = simple_hash(rd->id);
960
-
961
- if(name) strncpy(rd->name, name, RRD_STATS_NAME_MAX);
962
- else strncpy(rd->name, id, RRD_STATS_NAME_MAX);
963
-
961
// append this dimension
962
if(!st->dimensions)
963
st->dimensions = rd;
@@ -970,11 +967,16 @@ RRD_DIMENSION *rrd_stats_dimension_add(RRD_STATS *st, const char *id, const char
967
td->next = rd;
968
}
969
973
- //rd->annotator = annotator;
974
-
970
return(rd);
971
}
972
973
+void rrd_stats_dimension_set_name(RRD_STATS *st, RRD_DIMENSION *rd, const char *name)
974
+{
975
+ char varname[CONFIG_MAX_NAME + 1];
976
+ snprintf(varname, CONFIG_MAX_NAME, "dim %s name", rd->id);
977
+ config_get(st->id, varname, name);
978
+}
979
+
980
void rrd_stats_dimension_free(RRD_DIMENSION *rd)
981
{
982
if(rd->next) rrd_stats_dimension_free(rd->next);
@@ -1613,8 +1615,8 @@ unsigned long rrd_stats_one_json(RRD_STATS *st, char *options, struct web_buffer
1615
, st->name
1616
, st->type
1617
, st->family
1616
- , st->usertitle
1617
- , st->userpriority
1618
+ , st->title
1619
+ , st->priority
1620
, st->enabled
1621
, st->units
1622
, st->name, options?options:""
@@ -1825,29 +1827,51 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, siz
1827
long pad = before % group;
1828
1829
// checks for debuging
1828
- if(before < after)
1829
- debug(D_RRD_STATS, "WARNING: %s The newest value in the database (%lu) is earlier than the oldest (%lu)", st->name, before, after);
1830
+ if(st->debug) {
1831
+ debug(D_RRD_STATS, "%s first_entry_t = %lu, last_entry_t = %lu, duration = %lu, after = %lu, before = %lu, duration = %lu, entries_to_show = %lu, group = %lu"
1832
+ , st->id
1833
+ , rrd_stats_first_entry_t(st)
1834
+ , st->last_updated.tv_sec
1835
+ , st->last_updated.tv_sec - rrd_stats_first_entry_t(st)
1836
+ , after
1837
+ , before
1838
+ , before - after
1839
+ , entries_to_show
1840
+ , group
1841
+ );
1842
+
1843
+ if(before < after)
1844
+ debug(D_RRD_STATS, "WARNING: %s The newest value in the database (%lu) is earlier than the oldest (%lu)", st->name, before, after);
1845
1831
- if((before - after) > st->entries * st->update_every)
1832
- debug(D_RRD_STATS, "WARNING: %s The time difference between the oldest and the newest entries (%lu) is higher than the capacity of the database (%lu)", st->name, before - after, st->entries * st->update_every);
1846
+ if((before - after) > st->entries * st->update_every)
1847
+ debug(D_RRD_STATS, "WARNING: %s The time difference between the oldest and the newest entries (%lu) is higher than the capacity of the database (%lu)", st->name, before - after, st->entries * st->update_every);
1848
+ }
1849
1850
// loop in dimension data
1851
int annotate_reset = 0;
1836
- struct timeval now;
1837
- now.tv_sec = st->last_updated.tv_sec;
1838
- now.tv_usec = st->last_updated.tv_usec;
1839
- unsigned long long time_usec = now.tv_sec * 1000000ULL + now.tv_usec;
1852
+ unsigned long long time_usec = st->last_updated.tv_sec * 1000000ULL + st->last_updated.tv_usec;
1853
long t, count;
1854
for (count = printed = 0, t = current_entry; t != stop_entry && st->timediff[t] ; time_usec -= st->timediff[t], t--) {
1842
- int print_this = 0;
1843
-
1855
if(t < 0) t = st->entries - 1;
1856
1846
- now.tv_sec = time_usec / 1000000;
1847
- now.tv_usec = time_usec % 1000000;
1857
+ int print_this = 0;
1858
+ time_t now = time_usec / 1000000ULL;
1859
+
1860
+ if(st->debug) {
1861
+ debug(D_RRD_STATS, "%s t = %ld, count = %ld, group_count = %ld, printed = %ld, now = %lu, %s %s"
1862
+ , st->id
1863
+ , t
1864
+ , count + 1
1865
+ , group_count + 1
1866
+ , printed
1867
+ , now
1868
+ , (((count + 1 - pad) % group) == 0)?"PRINT":" - "
1869
+ , (now >= after && now <= before)?"RANGE":" - "
1870
+ );
1871
+ }
1872
1873
// make sure we return data in the proper time range
1850
- if(now.tv_sec < after || now.tv_sec > before) continue;
1874
+ if(now < after || now > before) continue;
1875
1876
count++;
1877
group_count++;
@@ -1871,14 +1895,13 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, siz
1895
web_buffer_increase(wb, line_size);
1896
1897
// generate the local date time
1874
- struct tm *tm = localtime(&now.tv_sec);
1898
+ struct tm *tm = localtime(&now);
1899
if(!tm) { error("localtime() failed."); continue; }
1876
- if(now.tv_sec > last_timestamp) last_timestamp = now.tv_sec;
1900
+ if(now > last_timestamp) last_timestamp = now;
1901
1902
if(printed) web_buffer_strcpy(wb, "]},\n");
1903
web_buffer_strcpy(wb, pre_date);
1880
- web_buffer_jsdate(wb, tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (int)(now.tv_usec / 1000));
1881
- // web_buffer_printf(wb, "%d, %d, %d, %d, %d, %d, %d", tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (int)(now.tv_usec / 1000));
1904
+ web_buffer_jsdate(wb, tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (int)((time_usec % 1000000ULL) / 1000));
1905
web_buffer_strcpy(wb, post_date);
1906
1907
print_this = 1;
@@ -2431,6 +2454,28 @@ void web_client_process(struct web_client *w)
2454
rrd_stats_graph_json(st, url, w->data);
2455
}
2456
}
2457
+ else if(strcmp(tok, "debug") == 0) {
2458
+ w->data->bytes = 0;
2459
+
2460
+ // get the name of the data to show
2461
+ tok = mystrsep(&url, "/?&");
2462
+ debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
2463
+
2464
+ // do we have such a data set?
2465
+ RRD_STATS *st = rrd_stats_find_byname(tok);
2466
+ if(!st) {
2467
+ code = 404;
2468
+ web_buffer_printf(w->data, "Chart %s is not found.\r\n", tok);
2469
+ debug(D_WEB_CLIENT_ACCESS, "%llu: %s is not found.", w->id, tok);
2470
+ }
2471
+ else {
2472
+ code = 200;
2473
+ debug_flags |= D_RRD_STATS;
2474
+ st->debug = st->debug?0:1;
2475
+ web_buffer_printf(w->data, "Chart %s has now debug %s.\r\n", tok, st->debug?"enabled":"disabled");
2476
+ debug(D_WEB_CLIENT_ACCESS, "%llu: debug for %s is %s.", w->id, tok, st->debug?"enabled":"disabled");
2477
+ }
2478
+ }
2479
else if(strcmp(tok, "mirror") == 0) {
2480
code = 200;
2481
@@ -5169,6 +5214,11 @@ void tc_device_commit(struct tc_device *d)
5214
else {
5215
unsigned long long usec = rrd_stats_next(st);
5216
debug(D_TC_LOOP, "TC: Committing TC device '%s' after %llu usec", d->name, usec);
5217
+
5218
+ if(strcmp(d->id, d->name) != 0) {
5219
+ // update the device name with the new one
5220
+ rrd_stats_set_name(st, d->name);
5221
+ }
5222
}
5223
5224
for ( c = d->classes ; c ; c = c->next) {
@@ -5185,7 +5235,7 @@ void tc_device_commit(struct tc_device *d)
5235
// update the rrd dimension with the new name
5236
RRD_DIMENSION *rd;
5237
for(rd = st->dimensions ; rd ; rd = rd->next) {
5188
- if(strcmp(rd->id, c->id) == 0) { strcpy(rd->name, c->name); break; }
5238
+ if(strcmp(rd->id, c->id) == 0) { rrd_stats_dimension_set_name(st, rd, c->name); break; }
5239
}
5240
}
5241
}
netdata.start
+15
-6
@@ -24,6 +24,9 @@ NETDATA_CONFIG_DEBUG=0
24
# our port
25
NETDATA_CONFIG_PORT=19999
26
27
+# our web files
28
+NETDATA_CONFIG_WEB_DIR=web
29
+
30
if [ -f netdata.conf ]
31
then
32
x="`grep "\[global\]" netdata.conf`"
@@ -48,6 +51,7 @@ then
51
52
# find the user to run as
53
NETDATA_CONFIG_USER="`grep 'run as user = ' netdata.conf | head -n 1 | cut -d '=' -f 2 | sed s"/ //g"`"
54
+ NETDATA_CONFIG_WEB_DIR="`grep 'web files directory = ' netdata.conf | head -n 1 | cut -d '=' -f 2 | sed -e s"/^ \+//g" -e s"/ \+$//g"`"
55
fi
56
fi
57
@@ -67,11 +71,18 @@ killall netdata 2>/dev/null
71
killall tc-all.sh 2>/dev/null
72
sleep 2
73
70
-if [ "$USER" = "root" -a ! -z "$NETDATA_CONFIG_USER" ]
74
+if [ "$USER" = "root" -a ! -z "$NETDATA_CONFIG_USER" -a -d "$NETDATA_CONFIG_WEB_DIR" ]
75
+then
76
+ echo "Chaning ownership of web files in $NETDATA_CONFIG_WEB_DIR to $NETDATA_CONFIG_USER"
77
+ chown -R "$NETDATA_CONFIG_USER" "$NETDATA_CONFIG_WEB_DIR" || exit 1
78
+ chmod 0775 "$NETDATA_CONFIG_WEB_DIR" || exit 1
79
+ chmod -R 0664 "$NETDATA_CONFIG_WEB_DIR" || exit 1
80
+fi
81
+
82
+if [ ! "$USER" = "root" ]
83
then
72
- chown -R "$NETDATA_CONFIG_USER" web || exit 1
73
- chmod 0775 web || exit 1
74
- chmod -R 0664 web/* || exit 1
84
+ echo >&2 "WARNING: NOT RUNNING AS ROOT - CANNOT SWITCH TO USER $NETDATA_CONFIG_USER"
85
+ echo >&2 "WARNING: MAKE SURE FILES IN web/ ARE OWNED BY $USER - or it will not work"
86
fi
87
88
echo "Starting netdata..."
@@ -85,8 +96,6 @@ else
96
then
97
`pwd`/netdata $debug_opts -d -u $NETDATA_CONFIG_USER -t $NETDATA_CONFIG_INTERNAL_UPDATE_EVERY -l $NETDATA_CONFIG_INTERNAL_HISTORY_LINES -p $NETDATA_CONFIG_PORT || exit 1
98
else
88
- echo >&2 "WARNING: NOT RUNNING AS ROOT - CANNOT SWITCH TO USER $NETDATA_CONFIG_USER"
89
- echo >&2 "WARNING: MAKE SURE FILES IN web/ ARE OWNED BY $USER - or it will not work"
99
`pwd`/netdata $debug_opts -d -t $NETDATA_CONFIG_INTERNAL_UPDATE_EVERY -l $NETDATA_CONFIG_INTERNAL_HISTORY_LINES -p $NETDATA_CONFIG_PORT || exit 1
100
fi
101
web/netdata.js
+7
-5
@@ -129,17 +129,19 @@ function calculateChartPointsToShow(c, divisor, maxtime, group) {
129
var dt = before - after;
130
if(dt > c.entries * c.update_every) dt = c.entries * c.update_every;
131
132
+ console.log('chart ' + c.id + ' internal duration is ' + dt + ' secs, requested maxtime is ' + maxtime + ' secs');
133
+
134
if(maxtime) dt = maxtime;
135
136
var data_points = Math.round(dt / c.update_every);
137
var screen_points = Math.round(c.chartOptions.width / divisor);
136
- mylog('screen = ' + screen_points + ', data = ' + data_points + ', divisor = ' + divisor);
138
+ console.log('screen = ' + screen_points + ', data = ' + data_points + ', divisor = ' + divisor);
139
140
if(group == undefined || group <= 0) {
141
if(screen_points > data_points) {
142
c.group = 1;
143
c.points_to_show = data_points;
142
- //mylog("rendering at full detail");
144
+ //console.log("rendering at full detail");
145
}
146
else {
147
c.group = Math.round(data_points / screen_points);
@@ -157,15 +159,15 @@ function calculateChartPointsToShow(c, divisor, maxtime, group) {
159
}
160
161
c.points_to_show = Math.round(data_points / c.group);
160
- //mylog("rendering adaptive");
162
+ //console.log("rendering adaptive");
163
}
164
}
165
else {
166
c.group = group;
167
c.points_to_show = Math.round(data_points / group);
166
- //mylog("rendering with given group");
168
+ //console.log("rendering with given group");
169
}
168
- mylog('group = ' + c.group + ', points = ' + c.points_to_show);
170
+ console.log('group = ' + c.group + ', points = ' + c.points_to_show);
171
172
// make sure the line width is not congesting the chart
173
if(c.chartType == 'LineChart') {