This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.006001; | |
use strict; | |
use warnings; | |
use Getopt::Long qw( GetOptions ); | |
GetOptions("a=s", \(my $stap_args), | |
"d", \(my $dump_src), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mt = {} | |
mt.__index = mt | |
function mt:get() | |
local max = 0 | |
local c = 0 | |
local cur = self.cur | |
for i = 1, self.num do | |
cur[i] = (cur[i] or 0) + self.wl[i] | |
if cur[i] > max then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local e = {} | |
local f = {} | |
local function put(n, pos) | |
if not(f[n]) then | |
f[n] = pos | |
else | |
local fpos = f[n] | |
while e[fpos][3] do | |
fpos = e[fpos][3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local raw_setmetatable = setmetatable | |
local setmetatable = function(t, mt) | |
local raw_t = raw_setmetatable(t, mt) | |
return raw_setmetatable({}, { | |
__index = function(raw, k) | |
if not(mt[k]) then | |
error("can not visit this member") | |
end | |
return function(_, ...) | |
return raw_t[k](raw_t, ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MTRAND_H__ | |
#define MTRAND_H__ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
/* Mersenne Twister was developed by Makoto Matsumoto and Takuji Nishimura */ | |
#define MT_N 624 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
net=5.422477ms,cluster=91.399046ms,cpu=323.263431ms,latency=5.447901ms,time=425.532855ms | |
login1:00000063 122.286771ms trace gm | |
login1:00000063 102.904420ms(net=3.207950ms,cluster=0.250590ms,cpu=3.580064ms,time=7.038604ms) call : @./service/agent/player/war_base.lua:363 @./service/agent/player/war_base.lua:130 @./service/agent/agent_lock.lua:62 | |
login1:00000009 3.568610ms request | |
login1:00000009 3.458540ms(time=0.250590ms) sleep : @./skynet/lualib/skynet/socketchannel.lua:374 @./skynet/service/clusterd.lua:147 @./skynet/service/clusterd.lua:252 | |
center:0000005d 0.250590ms tracecall begin | |
center:00000056 0.069562ms request | |
center:00000056 response | |
center:0000005d tracecall end | |
login1:00000009 0.011454ms resume |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum install -y systemtap systemtap-runtime | |
sudo yum install kernel-debuginfo kernel-debuginfo-common | |
sudo yum install yum-utils | |
debuginfo-install kernel-3.10.0-514.21.2.el7.x86_64 | |
sudo yum install -y kernel-devel-$(uname -r) | |
sudo yum install -y kernel-debuginfo-$(uname -r) | |
sudo yum install -y kernel-debuginfo-common-$(uname -m)-$(uname -r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function string_dump(s) | |
for p, c in utf8.codes(s) do | |
print(p, utf8.char(c)) | |
end | |
end | |
string_dump('12我3') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sizeof = function(str) { | |
let total = 0, charCode, i, len | |
for (i = 0, len = str.length; i < len; i++) { | |
charCode = str.charCodeAt(i) | |
if (charCode <= 0x007f) { | |
total += 1 | |
} else if (charCode <= 0x07ff) { | |
total += 2 | |
} else if (charCode <= 0xffff) { | |
total += 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// network = new Network(WebSocket || window.WebSocket || window.MozWebSocket) | |
// network.set_print(cc.log) | |
// network.set_delay(5) | |
// network.open_debug(true) | |
// network.connect('192.168.5.48', '8080') | |
// hall_echo = function() {} | |
// network.register('hall.echo', hall_echo) | |
// network.send_msg('hall.echo', {string: "123"}) | |
// network.send_msg('hall.echo', {string: "123"}, hall_echo) |
NewerOlder