/[pxelator]/couchdb/ping/views/ip-rtt.sum.nr/reduce.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /couchdb/ping/views/ip-rtt.sum.nr/reduce.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 384 - (show annotations)
Sun Aug 30 18:49:48 2009 UTC (14 years, 7 months ago) by dpavlin
File MIME type: application/javascript
File size: 294 byte(s)
produce average which must be finished on client because of rereduce
1 function (k,values,rereduce) {
2
3 if (rereduce) {
4 var total_sum = 0;
5 var total_length = 0;
6 for (var i = 0; i < values.length; i++) {
7 total_sum += values[i][0];
8 total_length += values[i][1];
9 }
10 return [total_sum, total_length];
11 } else {
12 return [sum(values), values.length];
13 }
14
15 }

  ViewVC Help
Powered by ViewVC 1.1.26