summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dispatch.go17
-rw-r--r--integration_test.go16
2 files changed, 26 insertions, 7 deletions
diff --git a/dispatch.go b/dispatch.go
index 1d67d9e46..f974ea5ae 100644
--- a/dispatch.go
+++ b/dispatch.go
@@ -10,6 +10,14 @@ var resChan = make(chan *BaseMsg, 10)
var doneChan = make(chan bool)
var wg sync.WaitGroup
+var stats struct {
+ v8workerSend int
+ v8workerRespond int
+ v8workerRecv int
+ v8workerBytesSent int
+ v8workerBytesRecv int
+}
+
// There is a single global worker for this process.
// This file should be the only part of deno that directly access it, so that
// all interaction with V8 can go through a single point.
@@ -24,6 +32,9 @@ func createWorker() {
}
func recv(buf []byte) (response []byte) {
+ stats.v8workerRecv++
+ stats.v8workerBytesRecv += len(buf)
+
msg := &BaseMsg{}
check(proto.Unmarshal(buf, msg))
assert(len(msg.Payload) > 0, "BaseMsg has empty payload.")
@@ -38,6 +49,10 @@ func recv(buf []byte) (response []byte) {
response = r
}
}
+ if response != nil {
+ stats.v8workerRespond++
+ stats.v8workerBytesSent += len(response)
+ }
return response
}
@@ -79,6 +94,8 @@ func DispatchLoop() {
case msg := <-resChan:
out, err := proto.Marshal(msg)
err = worker.SendBytes(out)
+ stats.v8workerSend++
+ stats.v8workerBytesSent += len(out)
exitOnError(err)
case <-doneChan:
// All goroutines have completed. Now we can exit main().
diff --git a/integration_test.go b/integration_test.go
index 90aad560b..aa2b99850 100644
--- a/integration_test.go
+++ b/integration_test.go
@@ -85,15 +85,17 @@ func deno(inputFn string) (actual []byte, cachedir string, err error) {
}
func integrationTestSetup() {
- startServer()
- cwd, err := os.Getwd()
- if err != nil {
- panic(err)
+ if denoFn == "" {
+ startServer()
+ cwd, err := os.Getwd()
+ if err != nil {
+ panic(err)
+ }
+ denoFn = path.Join(cwd, "deno")
}
- denoFn = path.Join(cwd, "deno")
}
-func TestIntegration(t *testing.T) {
+func TestIntegrationFiles(t *testing.T) {
integrationTestSetup()
outFiles := listTestFiles()
for _, outFile := range outFiles {
@@ -103,7 +105,7 @@ func TestIntegration(t *testing.T) {
}
}
-func TestUrlArgs(t *testing.T) {
+func TestIntegrationUrlArgs(t *testing.T) {
integrationTestSetup()
// Using good port 4545