whatap 0.4.79 → 0.4.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/keep-context.json +3 -3
- package/README.md +51 -51
- package/bindings/darwin/x64/whatap.node +0 -0
- package/bindings/linux/ia32/whatap.node +0 -0
- package/bindings/linux/x64/whatap.node +0 -0
- package/help.txt +10 -10
- package/index.js +8 -8
- package/lib/conf/conf-sys-mon.js +100 -100
- package/lib/conf/config-default.js +238 -238
- package/lib/conf/configure.js +423 -423
- package/lib/conf/license.js +41 -41
- package/lib/control/cmd-config.js +23 -23
- package/lib/control/control-handler.js +344 -344
- package/lib/control/packagectr-helper.js +149 -149
- package/lib/core/agent.js +329 -328
- package/lib/core/interceptor.js +142 -142
- package/lib/core/request-agent.js +26 -26
- package/lib/counter/counter-manager.js +127 -127
- package/lib/counter/meter/meter-activex.js +66 -66
- package/lib/counter/meter/meter-httpc.js +57 -57
- package/lib/counter/meter/meter-resource.js +9 -9
- package/lib/counter/meter/meter-service.js +167 -167
- package/lib/counter/meter/meter-socket.io.js +50 -50
- package/lib/counter/meter/meter-sql.js +70 -70
- package/lib/counter/meter/meter-users.js +57 -57
- package/lib/counter/meter.js +183 -183
- package/lib/counter/task/activetransaction.js +93 -93
- package/lib/counter/task/agentinfo.js +105 -105
- package/lib/counter/task/counter-task.js +9 -9
- package/lib/counter/task/gcstat.js +34 -34
- package/lib/counter/task/heapmem.js +24 -24
- package/lib/counter/task/httpc.js +75 -75
- package/lib/counter/task/proc-cpu.js +28 -28
- package/lib/counter/task/realtimeuser.js +30 -30
- package/lib/counter/task/res/systemECSTask.js +54 -54
- package/lib/counter/task/res/systemKubeTask.js +52 -52
- package/lib/counter/task/res/util/awsEcsClientThread.js +166 -166
- package/lib/counter/task/res/util/linuxProcStatUtil.js +13 -13
- package/lib/counter/task/res-sys-cpu.js +61 -61
- package/lib/counter/task/service.js +201 -201
- package/lib/counter/task/socketio.js +29 -29
- package/lib/counter/task/sql.js +104 -104
- package/lib/counter/task/systemperf.js +42 -42
- package/lib/data/datapack-sender.js +256 -256
- package/lib/data/dataprofile-agent.js +136 -136
- package/lib/data/datatext-agent.js +135 -135
- package/lib/data/event-level.js +15 -15
- package/lib/data/test.js +48 -48
- package/lib/env/constants.js +20 -20
- package/lib/kube/kube-client.js +143 -143
- package/lib/lang/text-types.js +58 -58
- package/lib/logger.js +319 -319
- package/lib/net/netflag.js +54 -54
- package/lib/net/paramdef.js +40 -40
- package/lib/net/receiver.js +65 -65
- package/lib/net/security-master.js +182 -173
- package/lib/net/sender.js +140 -140
- package/lib/net/tcp-return.js +17 -17
- package/lib/net/tcp-session.js +285 -285
- package/lib/net/tcpreq-client-proxy.js +69 -69
- package/lib/net/tcprequest-mgr.js +57 -57
- package/lib/observers/cluster-observer.js +21 -21
- package/lib/observers/express-observer.js +214 -214
- package/lib/observers/file-observer.js +184 -184
- package/lib/observers/global-observer.js +30 -30
- package/lib/observers/http-observer.js +714 -704
- package/lib/observers/maria-observer.js +382 -382
- package/lib/observers/memcached-observer.js +55 -55
- package/lib/observers/mongo-observer.js +262 -265
- package/lib/observers/mongodb-observer.js +197 -197
- package/lib/observers/mongoose-observer.js +83 -83
- package/lib/observers/mssql-observer.js +205 -205
- package/lib/observers/mysql-observer.js +436 -394
- package/lib/observers/net-observer.js +72 -72
- package/lib/observers/pgsql-observer.js +295 -295
- package/lib/observers/process-observer.js +25 -25
- package/lib/observers/promise-observer.js +31 -31
- package/lib/observers/redis-observer.js +156 -109
- package/lib/observers/schedule-observer.js +66 -66
- package/lib/observers/socket.io-observer.js +54 -54
- package/lib/observers/stream-observer.js +19 -19
- package/lib/observers/thrift-observer.js +196 -196
- package/lib/pack/activestack-pack.js +54 -54
- package/lib/pack/counter-pack.js +649 -649
- package/lib/pack/errorsnap-pack.js +68 -68
- package/lib/pack/event-pack.js +53 -53
- package/lib/pack/hitmap-pack.js +62 -62
- package/lib/pack/hitmap-pack1.js +146 -146
- package/lib/pack/netstat.js +14 -14
- package/lib/pack/pack.js +49 -49
- package/lib/pack/packenum.js +60 -60
- package/lib/pack/param-pack.js +213 -213
- package/lib/pack/profile-pack.js +48 -48
- package/lib/pack/realtimeuser-pack.js +40 -40
- package/lib/pack/stat-general-pack.js +95 -95
- package/lib/pack/staterror-pack.js +119 -119
- package/lib/pack/stathttpc-pack.js +66 -66
- package/lib/pack/stathttpc-rec.js +78 -78
- package/lib/pack/statremote-pack.js +45 -45
- package/lib/pack/statservice-pack.js +62 -62
- package/lib/pack/statservice-pack1.js +87 -87
- package/lib/pack/statservice-rec.js +292 -292
- package/lib/pack/statservice-rec_dep.js +151 -151
- package/lib/pack/statsql-pack.js +69 -69
- package/lib/pack/statsql-rec.js +100 -100
- package/lib/pack/statuseragent-pack.js +43 -43
- package/lib/pack/tagcount-pack.js +398 -398
- package/lib/pack/tagctr.js +14 -14
- package/lib/pack/text-pack.js +49 -49
- package/lib/pack/time-count.js +25 -25
- package/lib/pack/websocket.js +14 -14
- package/lib/plugin/plugin-loadermanager.js +56 -56
- package/lib/plugin/plugin.js +75 -75
- package/lib/requestlog.js +326 -326
- package/lib/service/tx-record.js +293 -288
- package/lib/stat/stat-error.js +116 -116
- package/lib/stat/stat-httpc.js +97 -97
- package/lib/stat/stat-remoteip.js +46 -46
- package/lib/stat/stat-sql.js +112 -112
- package/lib/stat/stat-tranx.js +57 -57
- package/lib/stat/stat-tx-caller.js +159 -159
- package/lib/stat/stat-tx-domain.js +110 -110
- package/lib/stat/stat-tx-referer.js +111 -111
- package/lib/stat/stat-useragent.js +48 -48
- package/lib/stat/timingsender.js +72 -72
- package/lib/step/activestack-step.js +37 -37
- package/lib/step/dbc-step.js +35 -35
- package/lib/step/http-stepx.js +66 -66
- package/lib/step/message-step.js +39 -39
- package/lib/step/method-stepx.js +46 -46
- package/lib/step/resultset-step.js +39 -39
- package/lib/step/securemsg-step.js +43 -43
- package/lib/step/socket-step.js +46 -46
- package/lib/step/sql-stepx.js +67 -67
- package/lib/step/sqlxtype.js +15 -15
- package/lib/step/step.js +65 -65
- package/lib/step/stepenum.js +53 -53
- package/lib/trace/local-context.js +13 -13
- package/lib/trace/parsed-sql.js +13 -13
- package/lib/trace/profile-collector.js +70 -70
- package/lib/trace/serviceurl-pattern-detector.js +117 -117
- package/lib/trace/trace-context-manager.js +195 -195
- package/lib/trace/trace-context.js +136 -134
- package/lib/util/anylist.js +102 -102
- package/lib/util/array-util.js +100 -100
- package/lib/util/bitutil.js +27 -27
- package/lib/util/cardinality/hyperloglog.js +105 -105
- package/lib/util/cardinality/murmurhash.js +31 -31
- package/lib/util/cardinality/registerset.js +74 -74
- package/lib/util/config-util.js +17 -17
- package/lib/util/cypher.js +89 -89
- package/lib/util/datetimehelper.js +237 -229
- package/lib/util/dateutil.js +110 -106
- package/lib/util/errordata.js +20 -20
- package/lib/util/escape-literal-sql.js +342 -342
- package/lib/util/hashutil2.js +126 -126
- package/lib/util/hexa32.js +57 -57
- package/lib/util/index.js +78 -78
- package/lib/util/intint-map.js +47 -47
- package/lib/util/intkey-linkedmap.js +26 -26
- package/lib/util/intkey-map.js +25 -25
- package/lib/util/intset.js +82 -82
- package/lib/util/iputil.js +119 -119
- package/lib/util/iputil_x.js +526 -526
- package/lib/util/keygen.js +17 -17
- package/lib/util/kube-util.js +72 -72
- package/lib/util/longint-linkedmap.js +35 -35
- package/lib/util/longkey-linkedmap.js +25 -25
- package/lib/util/longlong-linkedmap.js +37 -37
- package/lib/util/nodeutil.js +67 -67
- package/lib/util/oidutil.js +96 -93
- package/lib/util/paramsecurity.js +78 -78
- package/lib/util/pathtree.js +172 -172
- package/lib/util/pre-process.js +13 -13
- package/lib/util/process-seq.js +165 -165
- package/lib/util/property-util.js +35 -35
- package/lib/util/request-queue.js +42 -42
- package/lib/util/requestdouble-queue.js +72 -72
- package/lib/util/resourceprofile.js +156 -156
- package/lib/util/seedrandom.js +242 -242
- package/lib/util/stop-watch.js +29 -29
- package/lib/util/string-util.js +9 -9
- package/lib/util/stringkey-linkedmap.js +28 -28
- package/lib/util/stringnum-linkedmap.js +31 -31
- package/lib/util/stringset.js +65 -65
- package/lib/util/system-util.js +9 -9
- package/lib/util/userid-util.js +57 -57
- package/lib/util/utils.js +67 -67
- package/lib/value/blob-value.js +61 -61
- package/lib/value/boolean-value.js +51 -51
- package/lib/value/decimal-value.js +71 -71
- package/lib/value/double-summary.js +105 -105
- package/lib/value/double-value.js +50 -50
- package/lib/value/float-array.js +59 -59
- package/lib/value/float-value.js +64 -64
- package/lib/value/int-array.js +59 -59
- package/lib/value/int-map-value.js +151 -151
- package/lib/value/int-value.js +64 -64
- package/lib/value/ip4-value.js +83 -83
- package/lib/value/list-value.js +136 -136
- package/lib/value/long-array.js +59 -59
- package/lib/value/long-summary.js +105 -105
- package/lib/value/map-value.js +175 -175
- package/lib/value/metric-value.js +157 -157
- package/lib/value/null-value.js +42 -42
- package/lib/value/number-value.js +34 -34
- package/lib/value/summary-value.js +29 -29
- package/lib/value/text-array.js +117 -117
- package/lib/value/text-value.js +59 -59
- package/lib/value/texthash-value.js +49 -49
- package/lib/value/value.js +14 -14
- package/lib/value/valueenum.js +99 -99
- package/logs/whatap-20230906.log +54 -0
- package/logs/whatap-20231101.log +293 -0
- package/package.json +28 -28
- package/whatap.conf +1 -1
- package/logs/whatap-20230616.log +0 -13
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
-
* Use of this source code is governed by a license that
|
|
4
|
-
* can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var PackEnum = require('./packenum'),
|
|
8
|
-
Pack = require('./pack'),
|
|
9
|
-
Step = require('../step/step'),
|
|
10
|
-
DataOutputX = require('../io/data-outputx'),
|
|
11
|
-
Long = require('long');
|
|
12
|
-
|
|
13
|
-
function ErrorSnapPack1() {
|
|
14
|
-
Pack.call(this);
|
|
15
|
-
this.seq = Long.ZERO;
|
|
16
|
-
this.profile = null;
|
|
17
|
-
this.stack = null;
|
|
18
|
-
this.append_type = 0;
|
|
19
|
-
this.append_hash = 0;
|
|
20
|
-
this.setProfile = function(steps){
|
|
21
|
-
this.profile = Step.toBytes(steps);
|
|
22
|
-
return this;
|
|
23
|
-
};
|
|
24
|
-
this.setStack = function(callstacks) {
|
|
25
|
-
this.stack = new DataOutputX().writeIntArray(callstacks).toByteArray();
|
|
26
|
-
return this;
|
|
27
|
-
};
|
|
28
|
-
this.getProfile = function() {
|
|
29
|
-
return Step.toObjects(this.stack);
|
|
30
|
-
};
|
|
31
|
-
this.getStack = function() {
|
|
32
|
-
if( this.stack == null || this.stack.length === 0 ) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return this.stack;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
ErrorSnapPack1.prototype = new Pack();
|
|
40
|
-
ErrorSnapPack1.prototype.constructor = ErrorSnapPack1;
|
|
41
|
-
ErrorSnapPack1.prototype.toString = function() {
|
|
42
|
-
return "ErrorSnap " + Pack.prototype.toString.call(this)
|
|
43
|
-
+ ", profile_bytes="
|
|
44
|
-
+ ((this.profile != null) ? this.profile.length : 0)
|
|
45
|
-
+ " stack_bytes="
|
|
46
|
-
+ ((this.stack != null) ? this.stack.length : 0);
|
|
47
|
-
};
|
|
48
|
-
ErrorSnapPack1.prototype.getPackType = function () {
|
|
49
|
-
return PackEnum.ERROR_SNAP_1;
|
|
50
|
-
};
|
|
51
|
-
ErrorSnapPack1.prototype.write = function(dout) {
|
|
52
|
-
Pack.prototype.write.call(this, dout);
|
|
53
|
-
dout.writeLong(this.seq);
|
|
54
|
-
dout.writeBlob(this.profile);
|
|
55
|
-
dout.writeBlob(this.stack);
|
|
56
|
-
dout.writeByte(this.append_type);
|
|
57
|
-
dout.writeDecimal(this.append_hash);
|
|
58
|
-
};
|
|
59
|
-
ErrorSnapPack1.prototype.read = function(din) {
|
|
60
|
-
Pack.prototype.read.call(this, din);
|
|
61
|
-
this.seq = din.readLong();
|
|
62
|
-
this.profile = din.readBlob();
|
|
63
|
-
this.stack = din.readBlob();
|
|
64
|
-
this.append_type = din.readByte();
|
|
65
|
-
this.append_hash = din.readDecNumber();
|
|
66
|
-
return this;
|
|
67
|
-
};
|
|
68
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a license that
|
|
4
|
+
* can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack'),
|
|
9
|
+
Step = require('../step/step'),
|
|
10
|
+
DataOutputX = require('../io/data-outputx'),
|
|
11
|
+
Long = require('long');
|
|
12
|
+
|
|
13
|
+
function ErrorSnapPack1() {
|
|
14
|
+
Pack.call(this);
|
|
15
|
+
this.seq = Long.ZERO;
|
|
16
|
+
this.profile = null;
|
|
17
|
+
this.stack = null;
|
|
18
|
+
this.append_type = 0;
|
|
19
|
+
this.append_hash = 0;
|
|
20
|
+
this.setProfile = function(steps){
|
|
21
|
+
this.profile = Step.toBytes(steps);
|
|
22
|
+
return this;
|
|
23
|
+
};
|
|
24
|
+
this.setStack = function(callstacks) {
|
|
25
|
+
this.stack = new DataOutputX().writeIntArray(callstacks).toByteArray();
|
|
26
|
+
return this;
|
|
27
|
+
};
|
|
28
|
+
this.getProfile = function() {
|
|
29
|
+
return Step.toObjects(this.stack);
|
|
30
|
+
};
|
|
31
|
+
this.getStack = function() {
|
|
32
|
+
if( this.stack == null || this.stack.length === 0 ) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return this.stack;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ErrorSnapPack1.prototype = new Pack();
|
|
40
|
+
ErrorSnapPack1.prototype.constructor = ErrorSnapPack1;
|
|
41
|
+
ErrorSnapPack1.prototype.toString = function() {
|
|
42
|
+
return "ErrorSnap " + Pack.prototype.toString.call(this)
|
|
43
|
+
+ ", profile_bytes="
|
|
44
|
+
+ ((this.profile != null) ? this.profile.length : 0)
|
|
45
|
+
+ " stack_bytes="
|
|
46
|
+
+ ((this.stack != null) ? this.stack.length : 0);
|
|
47
|
+
};
|
|
48
|
+
ErrorSnapPack1.prototype.getPackType = function () {
|
|
49
|
+
return PackEnum.ERROR_SNAP_1;
|
|
50
|
+
};
|
|
51
|
+
ErrorSnapPack1.prototype.write = function(dout) {
|
|
52
|
+
Pack.prototype.write.call(this, dout);
|
|
53
|
+
dout.writeLong(this.seq);
|
|
54
|
+
dout.writeBlob(this.profile);
|
|
55
|
+
dout.writeBlob(this.stack);
|
|
56
|
+
dout.writeByte(this.append_type);
|
|
57
|
+
dout.writeDecimal(this.append_hash);
|
|
58
|
+
};
|
|
59
|
+
ErrorSnapPack1.prototype.read = function(din) {
|
|
60
|
+
Pack.prototype.read.call(this, din);
|
|
61
|
+
this.seq = din.readLong();
|
|
62
|
+
this.profile = din.readBlob();
|
|
63
|
+
this.stack = din.readBlob();
|
|
64
|
+
this.append_type = din.readByte();
|
|
65
|
+
this.append_hash = din.readDecNumber();
|
|
66
|
+
return this;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
69
|
module.exports = ErrorSnapPack1;
|
package/lib/pack/event-pack.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
-
* Use of this source code is governed by a license that
|
|
4
|
-
* can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var PackEnum = require('./packenum'),
|
|
8
|
-
Pack = require('./pack');
|
|
9
|
-
|
|
10
|
-
function EventPack() {
|
|
11
|
-
Pack.call(this);
|
|
12
|
-
this.level = 0;
|
|
13
|
-
this.title = '';
|
|
14
|
-
this.message = '';
|
|
15
|
-
this.attr = {};
|
|
16
|
-
}
|
|
17
|
-
EventPack.prototype = new Pack();
|
|
18
|
-
EventPack.prototype.constructor = EventPack;
|
|
19
|
-
EventPack.prototype.getPackType = function() {
|
|
20
|
-
return PackEnum.EVENT;
|
|
21
|
-
};
|
|
22
|
-
EventPack.prototype.write = function(dout) {
|
|
23
|
-
Pack.prototype.write.call(this, dout);
|
|
24
|
-
|
|
25
|
-
dout.writeByte(this.level);
|
|
26
|
-
dout.writeText(this.title);
|
|
27
|
-
dout.writeText(this.message);
|
|
28
|
-
dout.writeByte(Object.keys(this.attr).length);
|
|
29
|
-
|
|
30
|
-
for(key in this.attr) {
|
|
31
|
-
dout.writeText(key);
|
|
32
|
-
dout.writeText(this.attr[key]);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
EventPack.prototype.read = function(din) {
|
|
36
|
-
Pack.prototype.read.call(this, din);
|
|
37
|
-
|
|
38
|
-
this.level = din.readByte();
|
|
39
|
-
this.title = din.readText();
|
|
40
|
-
this.message = din.readText();
|
|
41
|
-
|
|
42
|
-
var keySize = din.readByte(),
|
|
43
|
-
key, value;
|
|
44
|
-
|
|
45
|
-
for(var i=0; i<keySize; i++) {
|
|
46
|
-
key = din.readText();
|
|
47
|
-
value = din.readText();
|
|
48
|
-
this.attr[key] = value;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return this;
|
|
52
|
-
};
|
|
53
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a license that
|
|
4
|
+
* can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack');
|
|
9
|
+
|
|
10
|
+
function EventPack() {
|
|
11
|
+
Pack.call(this);
|
|
12
|
+
this.level = 0;
|
|
13
|
+
this.title = '';
|
|
14
|
+
this.message = '';
|
|
15
|
+
this.attr = {};
|
|
16
|
+
}
|
|
17
|
+
EventPack.prototype = new Pack();
|
|
18
|
+
EventPack.prototype.constructor = EventPack;
|
|
19
|
+
EventPack.prototype.getPackType = function() {
|
|
20
|
+
return PackEnum.EVENT;
|
|
21
|
+
};
|
|
22
|
+
EventPack.prototype.write = function(dout) {
|
|
23
|
+
Pack.prototype.write.call(this, dout);
|
|
24
|
+
|
|
25
|
+
dout.writeByte(this.level);
|
|
26
|
+
dout.writeText(this.title);
|
|
27
|
+
dout.writeText(this.message);
|
|
28
|
+
dout.writeByte(Object.keys(this.attr).length);
|
|
29
|
+
|
|
30
|
+
for(key in this.attr) {
|
|
31
|
+
dout.writeText(key);
|
|
32
|
+
dout.writeText(this.attr[key]);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
EventPack.prototype.read = function(din) {
|
|
36
|
+
Pack.prototype.read.call(this, din);
|
|
37
|
+
|
|
38
|
+
this.level = din.readByte();
|
|
39
|
+
this.title = din.readText();
|
|
40
|
+
this.message = din.readText();
|
|
41
|
+
|
|
42
|
+
var keySize = din.readByte(),
|
|
43
|
+
key, value;
|
|
44
|
+
|
|
45
|
+
for(var i=0; i<keySize; i++) {
|
|
46
|
+
key = din.readText();
|
|
47
|
+
value = din.readText();
|
|
48
|
+
this.attr[key] = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
54
|
module.exports = EventPack;
|
package/lib/pack/hitmap-pack.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
-
* Use of this source code is governed by a license that
|
|
4
|
-
* can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var PackEnum = require('./packenum'),
|
|
8
|
-
Pack = require('./pack');
|
|
9
|
-
|
|
10
|
-
function HitMapPack() {
|
|
11
|
-
this.hitCount = 0;
|
|
12
|
-
this.errorCount = 0;
|
|
13
|
-
this.hit = [];
|
|
14
|
-
this.error = [];
|
|
15
|
-
this.time90pct = 0;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
HitMapPack.prototype.getPackType = function() {
|
|
19
|
-
return PackEnum.HITMAP;
|
|
20
|
-
};
|
|
21
|
-
HitMapPack.prototype.write = function(dout) {
|
|
22
|
-
|
|
23
|
-
Pack.prototype.write.call(this, dout);
|
|
24
|
-
dout.writeDecimal(this.hitCount);
|
|
25
|
-
dout.writeDecimal(this.errorCount);
|
|
26
|
-
dout.writeDecimal(this.time90pct);
|
|
27
|
-
this.writeIntArray(dout, this.hit);
|
|
28
|
-
this.writeIntArray(dout, this.error);
|
|
29
|
-
};
|
|
30
|
-
HitMapPack.prototype.read = function(din) {
|
|
31
|
-
|
|
32
|
-
Pack.prototype.read.call(this, din);
|
|
33
|
-
this.hitCount = din.readDecLong();
|
|
34
|
-
this.errorCount = din.readDecLong();
|
|
35
|
-
this.time90pct = din.readDecNumber();
|
|
36
|
-
this.readIntArray(din, this.hit);
|
|
37
|
-
this.readIntArray(din, this.error);
|
|
38
|
-
|
|
39
|
-
return this;
|
|
40
|
-
};
|
|
41
|
-
HitMapPack.prototype.writeIntArray = function(dout, v){
|
|
42
|
-
|
|
43
|
-
if(v == null) {
|
|
44
|
-
dout.writeByte(0);
|
|
45
|
-
} else {
|
|
46
|
-
dout.writeByte(v.length);
|
|
47
|
-
for(var val in v) {
|
|
48
|
-
dout.writeDecimal(val);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
HitMapPack.prototype.readIntArray = function(din, map) {
|
|
53
|
-
var len = din.readByte();
|
|
54
|
-
for(var i=0; i<len; i++) {
|
|
55
|
-
if(i < map.length) {
|
|
56
|
-
map[i] = din.readDecNumber();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
exports.Instance = HitMapPack;
|
|
62
|
-
exports.PCT_BOX = 50;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a license that
|
|
4
|
+
* can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack');
|
|
9
|
+
|
|
10
|
+
function HitMapPack() {
|
|
11
|
+
this.hitCount = 0;
|
|
12
|
+
this.errorCount = 0;
|
|
13
|
+
this.hit = [];
|
|
14
|
+
this.error = [];
|
|
15
|
+
this.time90pct = 0;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
HitMapPack.prototype.getPackType = function() {
|
|
19
|
+
return PackEnum.HITMAP;
|
|
20
|
+
};
|
|
21
|
+
HitMapPack.prototype.write = function(dout) {
|
|
22
|
+
|
|
23
|
+
Pack.prototype.write.call(this, dout);
|
|
24
|
+
dout.writeDecimal(this.hitCount);
|
|
25
|
+
dout.writeDecimal(this.errorCount);
|
|
26
|
+
dout.writeDecimal(this.time90pct);
|
|
27
|
+
this.writeIntArray(dout, this.hit);
|
|
28
|
+
this.writeIntArray(dout, this.error);
|
|
29
|
+
};
|
|
30
|
+
HitMapPack.prototype.read = function(din) {
|
|
31
|
+
|
|
32
|
+
Pack.prototype.read.call(this, din);
|
|
33
|
+
this.hitCount = din.readDecLong();
|
|
34
|
+
this.errorCount = din.readDecLong();
|
|
35
|
+
this.time90pct = din.readDecNumber();
|
|
36
|
+
this.readIntArray(din, this.hit);
|
|
37
|
+
this.readIntArray(din, this.error);
|
|
38
|
+
|
|
39
|
+
return this;
|
|
40
|
+
};
|
|
41
|
+
HitMapPack.prototype.writeIntArray = function(dout, v){
|
|
42
|
+
|
|
43
|
+
if(v == null) {
|
|
44
|
+
dout.writeByte(0);
|
|
45
|
+
} else {
|
|
46
|
+
dout.writeByte(v.length);
|
|
47
|
+
for(var val in v) {
|
|
48
|
+
dout.writeDecimal(val);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
HitMapPack.prototype.readIntArray = function(din, map) {
|
|
53
|
+
var len = din.readByte();
|
|
54
|
+
for(var i=0; i<len; i++) {
|
|
55
|
+
if(i < map.length) {
|
|
56
|
+
map[i] = din.readDecNumber();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.Instance = HitMapPack;
|
|
62
|
+
exports.PCT_BOX = 50;
|
|
63
63
|
exports.HIT_MAP = 51;
|
package/lib/pack/hitmap-pack1.js
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
-
* Use of this source code is governed by a license that
|
|
4
|
-
* can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var Pack = require('./pack'),
|
|
8
|
-
PackEnum = require('./packenum');
|
|
9
|
-
|
|
10
|
-
function HitMapPack1() {
|
|
11
|
-
Pack.call(this);
|
|
12
|
-
this.hit = new Array(HitMapPack1.LENGTH);
|
|
13
|
-
this.error = new Array(HitMapPack1.LENGTH);
|
|
14
|
-
|
|
15
|
-
this.hit.fill(0);
|
|
16
|
-
this.error.fill(0);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
HitMapPack1.LENGTH = 120;
|
|
20
|
-
HitMapPack1.prototype = new Pack();
|
|
21
|
-
HitMapPack1.prototype.constructor = HitMapPack1;
|
|
22
|
-
HitMapPack1.prototype.getPackType = function () {
|
|
23
|
-
return PackEnum.HITMAP_1;
|
|
24
|
-
};
|
|
25
|
-
HitMapPack1.prototype.write = function (dout) {
|
|
26
|
-
Pack.prototype.write.call(this, dout);
|
|
27
|
-
// dout.writeByte(1);
|
|
28
|
-
// for(var i=0; i<HitMapPack1.LENGTH; i++) {
|
|
29
|
-
// dout.writeShort(this.hit[i]);
|
|
30
|
-
// dout.writeShort(this.error[i]);
|
|
31
|
-
// }
|
|
32
|
-
dout.writeByte(3);// version
|
|
33
|
-
writeArr(dout, this.hit);
|
|
34
|
-
writeArr(dout, this.error);
|
|
35
|
-
};
|
|
36
|
-
HitMapPack1.prototype.read = function (din) {
|
|
37
|
-
Pack.prototype.read.call(this, din);
|
|
38
|
-
var ver = din.readByte();
|
|
39
|
-
|
|
40
|
-
if(ver === 1) {
|
|
41
|
-
for(var i=0; i<HitMapPack1.LENGTH; i++) {
|
|
42
|
-
this.hit[i] = din.readShort() & 0xffff;
|
|
43
|
-
this.error[i] = din.readShort() & 0xffff;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if(ver === 3){
|
|
47
|
-
readArr(din, this.hit);
|
|
48
|
-
readArr(din, this.error);
|
|
49
|
-
}
|
|
50
|
-
return this;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
function writeArr( dout, arr) {
|
|
54
|
-
if(arr==null){
|
|
55
|
-
dout.writeByte(0);
|
|
56
|
-
}else{
|
|
57
|
-
var len = HitMapPack1.LENGTH - 1;
|
|
58
|
-
for (; len >= 0; len--) {
|
|
59
|
-
if (arr[len] != 0)
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
len = len + 1;
|
|
63
|
-
dout.writeByte(len);
|
|
64
|
-
for (var i = 0; i < len; i++) {
|
|
65
|
-
dout.writeShort(arr[i]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function readArr( din, arr) {
|
|
71
|
-
var len = din.readByte() & 0xff;
|
|
72
|
-
for (var i = 0; i < len; i++) {
|
|
73
|
-
arr[i] = din.readShort() & 0xffff;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
HitMapPack1.prototype.copy = function () {
|
|
77
|
-
var newOne = new HitMapPack1();
|
|
78
|
-
newOne.pcode = this.pcode;
|
|
79
|
-
newOne.oid = this.oid;
|
|
80
|
-
newOne.time = this.time;
|
|
81
|
-
|
|
82
|
-
newOne.hit = this.hit.slice();
|
|
83
|
-
newOne.error = this.error.slice();
|
|
84
|
-
return newOne;
|
|
85
|
-
};
|
|
86
|
-
HitMapPack1.prototype.merge = function (p) {
|
|
87
|
-
for(var i=0; i<this.LENGTH; i++) {
|
|
88
|
-
this.hit[i] += p.hit[i];
|
|
89
|
-
this.error[i] += p.error[i];
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
HitMapPack1.prototype.add = function (time, isError) {
|
|
93
|
-
var idx = HitMapPack1.index(time);
|
|
94
|
-
this.hit[idx]++;
|
|
95
|
-
if(isError) {
|
|
96
|
-
this.error[idx]++;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
HitMapPack1.prototype.toString = function() {
|
|
100
|
-
return 'HitMap1 ' + Pack.prototype.toString.call(this) + ', hit=' + this.hit.length + ", error=" + this.error.length;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
HitMapPack1.index = function (time) {
|
|
104
|
-
var x = parseInt(time / 10000);
|
|
105
|
-
switch (x) {
|
|
106
|
-
case 0:
|
|
107
|
-
if (time < 5000)
|
|
108
|
-
return parseInt(time / 125);
|
|
109
|
-
else
|
|
110
|
-
return 40 + parseInt((time - 5000) / 250);
|
|
111
|
-
case 1:
|
|
112
|
-
return 60 + parseInt((time - 10000) / 500);
|
|
113
|
-
case 2:
|
|
114
|
-
case 3:
|
|
115
|
-
return 80 + parseInt((time - 20000) / 1000);
|
|
116
|
-
case 4:
|
|
117
|
-
case 5:
|
|
118
|
-
case 6:
|
|
119
|
-
case 7:
|
|
120
|
-
return 100 + parseInt((time - 40000) / 2000);
|
|
121
|
-
default:
|
|
122
|
-
return 119;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
HitMapPack1.time = function(index) {
|
|
126
|
-
var _time = 0;
|
|
127
|
-
if (index < 40)
|
|
128
|
-
return index * 125;
|
|
129
|
-
_time = 5000;
|
|
130
|
-
if (index < 60)
|
|
131
|
-
return _time + (index - 40) * 250;
|
|
132
|
-
_time = 10000;
|
|
133
|
-
if (index < 80)
|
|
134
|
-
return _time + (index - 60) * 500;
|
|
135
|
-
|
|
136
|
-
_time = 20000;
|
|
137
|
-
if (index < 100)
|
|
138
|
-
return _time + (index - 80) * 1000;
|
|
139
|
-
|
|
140
|
-
_time = 40000;
|
|
141
|
-
if (index < 120)
|
|
142
|
-
return _time + (index - 100) * 2000;
|
|
143
|
-
return 80000;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a license that
|
|
4
|
+
* can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var Pack = require('./pack'),
|
|
8
|
+
PackEnum = require('./packenum');
|
|
9
|
+
|
|
10
|
+
function HitMapPack1() {
|
|
11
|
+
Pack.call(this);
|
|
12
|
+
this.hit = new Array(HitMapPack1.LENGTH);
|
|
13
|
+
this.error = new Array(HitMapPack1.LENGTH);
|
|
14
|
+
|
|
15
|
+
this.hit.fill(0);
|
|
16
|
+
this.error.fill(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
HitMapPack1.LENGTH = 120;
|
|
20
|
+
HitMapPack1.prototype = new Pack();
|
|
21
|
+
HitMapPack1.prototype.constructor = HitMapPack1;
|
|
22
|
+
HitMapPack1.prototype.getPackType = function () {
|
|
23
|
+
return PackEnum.HITMAP_1;
|
|
24
|
+
};
|
|
25
|
+
HitMapPack1.prototype.write = function (dout) {
|
|
26
|
+
Pack.prototype.write.call(this, dout);
|
|
27
|
+
// dout.writeByte(1);
|
|
28
|
+
// for(var i=0; i<HitMapPack1.LENGTH; i++) {
|
|
29
|
+
// dout.writeShort(this.hit[i]);
|
|
30
|
+
// dout.writeShort(this.error[i]);
|
|
31
|
+
// }
|
|
32
|
+
dout.writeByte(3);// version
|
|
33
|
+
writeArr(dout, this.hit);
|
|
34
|
+
writeArr(dout, this.error);
|
|
35
|
+
};
|
|
36
|
+
HitMapPack1.prototype.read = function (din) {
|
|
37
|
+
Pack.prototype.read.call(this, din);
|
|
38
|
+
var ver = din.readByte();
|
|
39
|
+
|
|
40
|
+
if(ver === 1) {
|
|
41
|
+
for(var i=0; i<HitMapPack1.LENGTH; i++) {
|
|
42
|
+
this.hit[i] = din.readShort() & 0xffff;
|
|
43
|
+
this.error[i] = din.readShort() & 0xffff;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if(ver === 3){
|
|
47
|
+
readArr(din, this.hit);
|
|
48
|
+
readArr(din, this.error);
|
|
49
|
+
}
|
|
50
|
+
return this;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function writeArr( dout, arr) {
|
|
54
|
+
if(arr==null){
|
|
55
|
+
dout.writeByte(0);
|
|
56
|
+
}else{
|
|
57
|
+
var len = HitMapPack1.LENGTH - 1;
|
|
58
|
+
for (; len >= 0; len--) {
|
|
59
|
+
if (arr[len] != 0)
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
len = len + 1;
|
|
63
|
+
dout.writeByte(len);
|
|
64
|
+
for (var i = 0; i < len; i++) {
|
|
65
|
+
dout.writeShort(arr[i]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function readArr( din, arr) {
|
|
71
|
+
var len = din.readByte() & 0xff;
|
|
72
|
+
for (var i = 0; i < len; i++) {
|
|
73
|
+
arr[i] = din.readShort() & 0xffff;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
HitMapPack1.prototype.copy = function () {
|
|
77
|
+
var newOne = new HitMapPack1();
|
|
78
|
+
newOne.pcode = this.pcode;
|
|
79
|
+
newOne.oid = this.oid;
|
|
80
|
+
newOne.time = this.time;
|
|
81
|
+
|
|
82
|
+
newOne.hit = this.hit.slice();
|
|
83
|
+
newOne.error = this.error.slice();
|
|
84
|
+
return newOne;
|
|
85
|
+
};
|
|
86
|
+
HitMapPack1.prototype.merge = function (p) {
|
|
87
|
+
for(var i=0; i<this.LENGTH; i++) {
|
|
88
|
+
this.hit[i] += p.hit[i];
|
|
89
|
+
this.error[i] += p.error[i];
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
HitMapPack1.prototype.add = function (time, isError) {
|
|
93
|
+
var idx = HitMapPack1.index(time);
|
|
94
|
+
this.hit[idx]++;
|
|
95
|
+
if(isError) {
|
|
96
|
+
this.error[idx]++;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
HitMapPack1.prototype.toString = function() {
|
|
100
|
+
return 'HitMap1 ' + Pack.prototype.toString.call(this) + ', hit=' + this.hit.length + ", error=" + this.error.length;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
HitMapPack1.index = function (time) {
|
|
104
|
+
var x = parseInt(time / 10000);
|
|
105
|
+
switch (x) {
|
|
106
|
+
case 0:
|
|
107
|
+
if (time < 5000)
|
|
108
|
+
return parseInt(time / 125);
|
|
109
|
+
else
|
|
110
|
+
return 40 + parseInt((time - 5000) / 250);
|
|
111
|
+
case 1:
|
|
112
|
+
return 60 + parseInt((time - 10000) / 500);
|
|
113
|
+
case 2:
|
|
114
|
+
case 3:
|
|
115
|
+
return 80 + parseInt((time - 20000) / 1000);
|
|
116
|
+
case 4:
|
|
117
|
+
case 5:
|
|
118
|
+
case 6:
|
|
119
|
+
case 7:
|
|
120
|
+
return 100 + parseInt((time - 40000) / 2000);
|
|
121
|
+
default:
|
|
122
|
+
return 119;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
HitMapPack1.time = function(index) {
|
|
126
|
+
var _time = 0;
|
|
127
|
+
if (index < 40)
|
|
128
|
+
return index * 125;
|
|
129
|
+
_time = 5000;
|
|
130
|
+
if (index < 60)
|
|
131
|
+
return _time + (index - 40) * 250;
|
|
132
|
+
_time = 10000;
|
|
133
|
+
if (index < 80)
|
|
134
|
+
return _time + (index - 60) * 500;
|
|
135
|
+
|
|
136
|
+
_time = 20000;
|
|
137
|
+
if (index < 100)
|
|
138
|
+
return _time + (index - 80) * 1000;
|
|
139
|
+
|
|
140
|
+
_time = 40000;
|
|
141
|
+
if (index < 120)
|
|
142
|
+
return _time + (index - 100) * 2000;
|
|
143
|
+
return 80000;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
|
|
147
147
|
module.exports = HitMapPack1;
|