diff --git a/cmd/stress/inquirerstress/stresstest.go b/cmd/stress/inquirerstress/inquirerstress.go similarity index 100% rename from cmd/stress/inquirerstress/stresstest.go rename to cmd/stress/inquirerstress/inquirerstress.go diff --git a/cmd/stress/inquirerstress/stresstest.py b/cmd/stress/inquirerstress/inquirerstress.py similarity index 100% rename from cmd/stress/inquirerstress/stresstest.py rename to cmd/stress/inquirerstress/inquirerstress.py diff --git a/cmd/stress/raterstress/raterstress.go b/cmd/stress/raterstress/raterstress.go new file mode 100644 index 000000000..e69de29bb diff --git a/cmd/stress/spansstress/tsstress.go b/cmd/stress/spansstress/spansstress.go similarity index 100% rename from cmd/stress/spansstress/tsstress.go rename to cmd/stress/spansstress/spansstress.go diff --git a/cmd/stresstest/stresstest.go b/cmd/stresstest/stresstest.go deleted file mode 100644 index beea3b81f..000000000 --- a/cmd/stresstest/stresstest.go +++ /dev/null @@ -1,33 +0,0 @@ -package main - -import ( - "github.com/rif/cgrates/timespans" - "log" - "net/rpc/jsonrpc" - "time" -) - -func main() { - t1 := time.Date(2012, time.February, 02, 17, 30, 0, 0, time.UTC) - t2 := time.Date(2012, time.February, 02, 18, 30, 0, 0, time.UTC) - cd := timespans.CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2} - result := timespans.CallCost{} - client, _ := jsonrpc.Dial("tcp", "localhost:5090") - runs := int(1e5) - i := 0 - c := make(chan string) - for ; i < runs; i++ { - go func() { - var reply string - client.Call("Responder.Get", cd, &result) - c <- reply - }() - //time.Sleep(1*time.Second) - } - for j := 0; j < runs; j++ { - <-c - } - log.Println(result) - log.Println(i) - client.Close() -} diff --git a/cmd/stresstest/stresstest.py b/cmd/stresstest/stresstest.py deleted file mode 100644 index 340571b9c..000000000 --- a/cmd/stresstest/stresstest.py +++ /dev/null @@ -1,57 +0,0 @@ -# jsonclient.py -# A simple JSONRPC client library, created to work with Go servers -# Written by Stephen Day -# Modified by Bruce Eckel to work with both Python 2 & 3 -import json, socket, itertools -from datetime import datetime - -class JSONClient(object): - - def __init__(self, addr, codec=json): - self._socket = socket.create_connection(addr) - self._id_iter = itertools.count() - self._codec = codec - - def _message(self, name, *params): - return dict(id=next(self._id_iter), - params=list(params), - method=name) - - def call(self, name, *params): - request = self._message(name, *params) - id = request.get('id') - msg = self._codec.dumps(request) - self._socket.sendall(msg.encode()) - - # This will actually have to loop if resp is bigger - response = self._socket.recv(4096) - response = self._codec.loads(response.decode()) - - if response.get('id') != id: - raise Exception("expected id=%s, received id=%s: %s" - %(id, response.get('id'), - response.get('error'))) - - if response.get('error') is not None: - raise Exception(response.get('error')) - - return response.get('result') - - def close(self): - self._socket.close() - - -rpc =JSONClient(("127.0.0.1", 5090)) - -cd = {"Tor":0, "CstmId": "vdf", "Subject": "rif", "DestinationPrefix": "0256", "TimeStart": "2012-02-02T17:30:00Z", "TimeEnd": "2012-02-02T18:30:00Z"} - -# alternative to the above -s = socket.create_connection(("127.0.0.1", 5090)) -s.sendall(json.dumps(({"id": 1, "method": "Responder.Get", "params": [cd]}))) -print s.recv(4096) - -i = 0 -result = "" -for i in xrange(int(1e5) + 1): - result = rpc.call("Responder.Get", cd) -print i, result diff --git a/cmd/tsstress/tsstress.go b/cmd/tsstress/tsstress.go deleted file mode 100644 index 401c27652..000000000 --- a/cmd/tsstress/tsstress.go +++ /dev/null @@ -1,41 +0,0 @@ -package main - -import ( - "flag" - "github.com/rif/cgrates/timespans" - "log" - "os" - "runtime/pprof" - "time" -) - -var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") - -func main() { - flag.Parse() - - if *cpuprofile != "" { - f, err := os.Create(*cpuprofile) - if err != nil { - log.Fatal(err) - } - pprof.StartCPUProfile(f) - defer pprof.StopCPUProfile() - } - - t1 := time.Date(2012, time.February, 02, 17, 30, 0, 0, time.UTC) - t2 := time.Date(2012, time.February, 02, 18, 30, 0, 0, time.UTC) - cd := timespans.CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2} - - i := 0 - result := ×pans.CallCost{} - - getter, _ := timespans.NewRedisStorage("", 10) - defer getter.Close() - - for ; i < 1e5; i++ { - result, _ = cd.GetCost(getter) - } - log.Print(result) - log.Print(i) -}