git reimport
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
From 9a3a25a8aec5dde88a322f0905f3c3a56d3ad1d5 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Obryk <robryk@google.com>
|
||||
Date: Tue, 28 Apr 2015 00:04:36 +0200
|
||||
Subject: [PATCH] Fix a nil dereference when an instance fails to start.
|
||||
|
||||
---
|
||||
instances.go | 2 +-
|
||||
instances_test.go | 8 ++++++++
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git instances.go instances.go
|
||||
index ea19ff8..f782a79 100644
|
||||
--- instances.go
|
||||
+++ instances.go
|
||||
@@ -43,11 +43,11 @@ func RunInstances(cmds []*exec.Cmd, commLog io.Writer) ([]*Instance, error) {
|
||||
ResponseChan: make(chan *response, 1),
|
||||
}
|
||||
if err := is[i].Start(); err != nil {
|
||||
- is[i] = nil
|
||||
select {
|
||||
case results <- InstanceError{i, err}:
|
||||
default:
|
||||
}
|
||||
+ close(is[i].RequestChan)
|
||||
continue
|
||||
}
|
||||
defer is[i].Kill()
|
||||
diff --git instances_test.go instances_test.go
|
||||
index a00f7ef..5c13709 100644
|
||||
--- instances_test.go
|
||||
+++ instances_test.go
|
||||
@@ -76,5 +76,13 @@ func TestInstances(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
+func TestInstancesStartError(t *testing.T) {
|
||||
+ cmds := []*exec.Cmd{exec.Command("/does/not/exist")}
|
||||
+ _, err := RunInstances(cmds, ioutil.Discard)
|
||||
+ if err == nil {
|
||||
+ t.Errorf("expected an error when trying to run a nonexistent binary")
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// TODO: check what happens when we send/recv message to/from an instance that doesn't exist
|
||||
// TODO: check what happens when an instance claims that its CPU time goes backward
|
||||
--
|
||||
2.2.0.rc0.207.ga3a616c
|
||||
|
25
dcj/tool/src/parunner/patches/0002-go-vet.patch
Normal file
25
dcj/tool/src/parunner/patches/0002-go-vet.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From 40cf238d611563b9d6af96f0fe950eabb6350874 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Obryk <robryk@google.com>
|
||||
Date: Tue, 28 Apr 2015 00:29:37 +0200
|
||||
Subject: [PATCH] go vet
|
||||
|
||||
---
|
||||
instance_test.go | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git instance_test.go instance_test.go
|
||||
index edd0371..28a378f 100644
|
||||
--- instance_test.go
|
||||
+++ instance_test.go
|
||||
@@ -158,7 +158,7 @@ func TestInstanceComm(t *testing.T) {
|
||||
t.Errorf("test %s: wrong output; got=%q, want=%q", tc.name, got, want)
|
||||
}
|
||||
if rt := <-lastReqTime; instance.TimeRunning < rt {
|
||||
- t.Errorf("test %s: instance's last request happened at %v, but instance used only %v CPU time total", rt, instance.TimeRunning)
|
||||
+ t.Errorf("test %s: instance's last request happened at %v, but instance used only %v CPU time total", tc.name, rt, instance.TimeRunning)
|
||||
}
|
||||
}
|
||||
testcases := []testcase{
|
||||
--
|
||||
2.2.0.rc0.207.ga3a616c
|
||||
|
@@ -0,0 +1,54 @@
|
||||
From 5b52c40f67b2ff06cd893df278e2d3c3e8751797 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Obryk <robryk@google.com>
|
||||
Date: Wed, 6 May 2015 19:57:27 +0200
|
||||
Subject: [PATCH] Use cwd instead of $PATH when looking up the binary.
|
||||
|
||||
This causes parunner blah to actually run ./blah instead of erroring
|
||||
out.
|
||||
---
|
||||
main.go | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git main.go main.go
|
||||
index 74419d7..3fb6b2b 100644
|
||||
--- main.go
|
||||
+++ main.go
|
||||
@@ -63,18 +63,25 @@ func main() {
|
||||
log.SetFlags(log.Lmicroseconds | log.Lshortfile)
|
||||
flag.Usage = Usage
|
||||
flag.Parse()
|
||||
+
|
||||
if flag.NArg() != 1 {
|
||||
fmt.Fprintf(os.Stderr, "Nie podałeś programu do uruchomienia\n")
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
- binaryPath = flag.Arg(0)
|
||||
+ var err error
|
||||
+ binaryPath, err = filepath.Abs(flag.Arg(0))
|
||||
+ if err != nil {
|
||||
+ fmt.Fprintf(os.Stderr, "Cannot find absolute path of the binary: %v\n", err)
|
||||
+ os.Exit(1)
|
||||
+ }
|
||||
|
||||
if *nInstances < 1 || *nInstances > MaxInstances {
|
||||
fmt.Fprintf(os.Stderr, "Liczba instancji powinna być z zakresu [1,%d], a podałeś %d\n", MaxInstances, *nInstances)
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
+
|
||||
var writeStdout func(int, io.Reader) error
|
||||
contestStdout := &ContestStdout{Output: os.Stdout}
|
||||
switch *stdoutHandling {
|
||||
@@ -122,7 +129,7 @@ func main() {
|
||||
var wg sync.WaitGroup
|
||||
closeAfterWait := []io.Closer{}
|
||||
for i := range progs {
|
||||
- cmd := exec.Command(flag.Arg(0))
|
||||
+ cmd := exec.Command(binaryPath)
|
||||
w, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
--
|
||||
2.2.0.rc0.207.ga3a616c
|
||||
|
@@ -0,0 +1,52 @@
|
||||
From 045611330af23d7a9c1e510a8e69f6fa52f6290b Mon Sep 17 00:00:00 2001
|
||||
From: Robert Obryk <robryk@google.com>
|
||||
Date: Wed, 6 May 2015 20:03:05 +0200
|
||||
Subject: [PATCH] Custom error types for limits exceeded
|
||||
|
||||
---
|
||||
comm.go | 19 +++++++++++++++----
|
||||
1 file changed, 15 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git comm.go comm.go
|
||||
index c153cee..785bbc2 100644
|
||||
--- comm.go
|
||||
+++ comm.go
|
||||
@@ -49,8 +49,19 @@ type Message struct {
|
||||
Message []byte
|
||||
}
|
||||
|
||||
-var ErrMessageCount = fmt.Errorf("przekroczony limit (%d) liczby wysłanych wiadomości", MessageCountLimit)
|
||||
-var ErrMessageSize = fmt.Errorf("przekroczony limit (%d bajtów) sumarycznego rozmiaru wysłanych wiadomości", MessageSizeLimit)
|
||||
+type ErrMessageCount struct {
|
||||
+}
|
||||
+
|
||||
+func (err ErrMessageCount) Error() string {
|
||||
+ return fmt.Sprintf("przekroczony limit (%d) liczby wysłanych wiadomości", MessageCountLimit)
|
||||
+}
|
||||
+
|
||||
+type ErrMessageSize struct {
|
||||
+}
|
||||
+
|
||||
+func (err ErrMessageSize) Error() string {
|
||||
+ return fmt.Sprintf("przekroczony limit (%d bajtów) sumarycznego rozmiaru wysłanych wiadomości", MessageSizeLimit)
|
||||
+}
|
||||
|
||||
func writeMessage(w io.Writer, message *Message) error {
|
||||
rr := recvResponse{
|
||||
@@ -175,11 +186,11 @@ func (i *Instance) communicate(r io.Reader, w io.Writer, reqCh chan<- *request,
|
||||
if req.requestType == requestSend {
|
||||
i.MessagesSent++
|
||||
if i.MessagesSent > MessageCountLimit {
|
||||
- return ErrMessageCount
|
||||
+ return ErrMessageCount{}
|
||||
}
|
||||
i.MessageBytesSent += len(req.message)
|
||||
if i.MessageBytesSent > MessageSizeLimit {
|
||||
- return ErrMessageSize
|
||||
+ return ErrMessageSize{}
|
||||
}
|
||||
}
|
||||
currentTime := req.time
|
||||
--
|
||||
2.2.0.rc0.207.ga3a616c
|
||||
|
@@ -0,0 +1,84 @@
|
||||
From 9306327ecb86f6c6037c7fb8eecd10a5b82d2c39 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Obryk <robryk@google.com>
|
||||
Date: Wed, 6 May 2015 20:23:54 +0200
|
||||
Subject: [PATCH] Hack: allow message limits to be set on cmdline
|
||||
|
||||
---
|
||||
comm.go | 20 +++++++++++++-------
|
||||
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git comm.go comm.go
|
||||
index 785bbc2..2d532fb 100644
|
||||
--- comm.go
|
||||
+++ comm.go
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
+ "flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
@@ -39,8 +40,9 @@ type sendHeader struct {
|
||||
// Message []byte
|
||||
}
|
||||
|
||||
-const MessageCountLimit = 1000
|
||||
-const MessageSizeLimit = 8 * 1024 * 1024
|
||||
+// TODO(robryk): Move this to instance-creation-time options
|
||||
+var messageCountLimit = flag.Int("message_count_limit", 1000, "Limit for the number of messages sent per instance")
|
||||
+var messageSizeLimit = flag.Int("message_size_limit", 8*1024*1024, "Limit for the total size of messages sent by an instance, in bytes")
|
||||
|
||||
type Message struct {
|
||||
Source int
|
||||
@@ -49,18 +51,22 @@ type Message struct {
|
||||
Message []byte
|
||||
}
|
||||
|
||||
+// ErrMessageCount is returned when an instance exceeds the per-instance message count limit.
|
||||
+// It is usually encapsulated in an InstanceError that specifies the instance ID.
|
||||
type ErrMessageCount struct {
|
||||
}
|
||||
|
||||
func (err ErrMessageCount) Error() string {
|
||||
- return fmt.Sprintf("przekroczony limit (%d) liczby wysłanych wiadomości", MessageCountLimit)
|
||||
+ return fmt.Sprintf("przekroczony limit (%d) liczby wysłanych wiadomości", *messageCountLimit)
|
||||
}
|
||||
|
||||
+// ErrMessageSize is returned when an instance exceeds the per-instance total messages size limit.
|
||||
+// It is usually encapsulated in an InstanceError that specifies the instance ID.
|
||||
type ErrMessageSize struct {
|
||||
}
|
||||
|
||||
func (err ErrMessageSize) Error() string {
|
||||
- return fmt.Sprintf("przekroczony limit (%d bajtów) sumarycznego rozmiaru wysłanych wiadomości", MessageSizeLimit)
|
||||
+ return fmt.Sprintf("przekroczony limit (%d bajtów) sumarycznego rozmiaru wysłanych wiadomości", *messageSizeLimit)
|
||||
}
|
||||
|
||||
func writeMessage(w io.Writer, message *Message) error {
|
||||
@@ -135,7 +141,7 @@ func readRequest(r io.Reader) (*request, error) {
|
||||
if err := binary.Read(r, binary.LittleEndian, &sh); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
- if sh.Length < 0 || sh.Length > MessageSizeLimit {
|
||||
+ if sh.Length < 0 || int(sh.Length) > *messageSizeLimit {
|
||||
return nil, fmt.Errorf("invalid size of a message to be sent: %d", sh.Length)
|
||||
}
|
||||
if sh.TargetID < 0 || sh.TargetID >= MaxInstances {
|
||||
@@ -185,11 +191,11 @@ func (i *Instance) communicate(r io.Reader, w io.Writer, reqCh chan<- *request,
|
||||
req.time += i.TimeBlocked
|
||||
if req.requestType == requestSend {
|
||||
i.MessagesSent++
|
||||
- if i.MessagesSent > MessageCountLimit {
|
||||
+ if i.MessagesSent > *messageCountLimit {
|
||||
return ErrMessageCount{}
|
||||
}
|
||||
i.MessageBytesSent += len(req.message)
|
||||
- if i.MessageBytesSent > MessageSizeLimit {
|
||||
+ if i.MessageBytesSent > *messageSizeLimit {
|
||||
return ErrMessageSize{}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.2.0.rc0.207.ga3a616c
|
||||
|
@@ -0,0 +1,36 @@
|
||||
From 20bc419d7146c11ca9d058eccfcb6c1eacce7650 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Obryk <robryk@google.com>
|
||||
Date: Thu, 28 May 2015 23:14:41 +0200
|
||||
Subject: [PATCH] Fix a testee crash when Send or Receive are called early.
|
||||
|
||||
Send and receive in zeus_local.c didn't check if the library is
|
||||
initialized and thus failed due to an assert if that happened.
|
||||
|
||||
TODO: Add a regression test.
|
||||
---
|
||||
zeus/zeus_local.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git zeus/zeus_local.c zeus/zeus_local.c
|
||||
index 8b25897..314a1d0 100644
|
||||
--- zeus/zeus_local.c
|
||||
+++ zeus/zeus_local.c
|
||||
@@ -114,6 +114,7 @@ static int CurrentTime() {
|
||||
#endif
|
||||
|
||||
void ZEUS(Send)(ZEUS(NodeId) target, const char* message, int bytes) {
|
||||
+ Init();
|
||||
assert(target >= 0 && target < nof_nodes);
|
||||
assert(bytes <= MAX_MESSAGE_SIZE);
|
||||
int i;
|
||||
@@ -127,6 +128,7 @@ void ZEUS(Send)(ZEUS(NodeId) target, const char* message, int bytes) {
|
||||
}
|
||||
|
||||
ZEUS(MessageInfo) ZEUS(Receive)(ZEUS(NodeId) source, char* buffer, int buffer_size) {
|
||||
+ Init();
|
||||
assert(source >= -1 && source < nof_nodes);
|
||||
ZEUS(MessageInfo) mi;
|
||||
int i;
|
||||
--
|
||||
2.2.0.rc0.207.ga3a616c
|
||||
|
@@ -0,0 +1,194 @@
|
||||
From 40100b7a3dcc1275b69e13d32374b6d78c43a303 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Obryk <robryk@google.com>
|
||||
Date: Mon, 4 May 2015 21:18:15 +0200
|
||||
Subject: [PATCH] translate user-visible messages to English
|
||||
|
||||
This change is not supposed to be upstreamed in this form. I will try to
|
||||
find a way to keep both language versions in the same codebase.
|
||||
---
|
||||
comm.go | 4 ++--
|
||||
instances.go | 2 +-
|
||||
main.go | 42 +++++++++++++++++++++---------------------
|
||||
route.go | 4 ++--
|
||||
util.go | 2 +-
|
||||
5 files changed, 27 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git comm.go comm.go
|
||||
index 2d532fb..e043a89 100644
|
||||
--- comm.go
|
||||
+++ comm.go
|
||||
@@ -57,7 +57,7 @@ type ErrMessageCount struct {
|
||||
}
|
||||
|
||||
func (err ErrMessageCount) Error() string {
|
||||
- return fmt.Sprintf("przekroczony limit (%d) liczby wysłanych wiadomości", *messageCountLimit)
|
||||
+ return fmt.Sprintf("sent message count limit (%d) exceeded", *messageCountLimit)
|
||||
}
|
||||
|
||||
// ErrMessageSize is returned when an instance exceeds the per-instance total messages size limit.
|
||||
@@ -66,7 +66,7 @@ type ErrMessageSize struct {
|
||||
}
|
||||
|
||||
func (err ErrMessageSize) Error() string {
|
||||
- return fmt.Sprintf("przekroczony limit (%d bajtów) sumarycznego rozmiaru wysłanych wiadomości", *messageSizeLimit)
|
||||
+ return fmt.Sprintf("total sent message size limit (%d bytes) exceeded", *messageSizeLimit)
|
||||
}
|
||||
|
||||
func writeMessage(w io.Writer, message *Message) error {
|
||||
diff --git instances.go instances.go
|
||||
index f782a79..6e65ef6 100644
|
||||
--- instances.go
|
||||
+++ instances.go
|
||||
@@ -14,7 +14,7 @@ type InstanceError struct {
|
||||
}
|
||||
|
||||
func (ie InstanceError) Error() string {
|
||||
- return fmt.Sprintf("Błąd instancji %d: %v", ie.ID, ie.Err)
|
||||
+ return fmt.Sprintf("Error of instance %d: %v", ie.ID, ie.Err)
|
||||
}
|
||||
|
||||
// RunInstances starts each command from cmds in an Instance and
|
||||
diff --git main.go main.go
|
||||
index 3fb6b2b..54ba230 100644
|
||||
--- main.go
|
||||
+++ main.go
|
||||
@@ -17,13 +17,13 @@ import (
|
||||
|
||||
const MaxInstances = 100
|
||||
|
||||
-var nInstances = flag.Int("n", 1, fmt.Sprintf("Liczba instancji, z zakresu [1,%d]", MaxInstances))
|
||||
-var stdoutHandling = flag.String("stdout", "contest", "Obługa standardowego wyjścia: contest, all, tagged, files")
|
||||
-var stderrHandling = flag.String("stderr", "all", "Obsługa standardowe wyjścia diagnostycznego: all, tagged, files")
|
||||
-var filesPrefix = flag.String("prefix", "", "Prefiks nazwy plików wyjściowych generowanych przez -stdout=files i -stderr=files")
|
||||
-var warnRemaining = flag.Bool("warn_unreceived", true, "Ostrzegaj o wiadomościach, które pozostały nieodebrane po zakończeniu się instancji")
|
||||
-var stats = flag.Bool("print_stats", false, "Na koniec wypisz statystyki dotyczące poszczególnych instancji")
|
||||
-var traceCommunications = flag.Bool("trace_comm", false, "Wypisz na standardowe wyjście diagnostyczne informację o każdej wysłanej i odebranej wiadomości")
|
||||
+var nInstances = flag.Int("n", 1, fmt.Sprintf("Number of instances; must be from the [1,%d] range", MaxInstances))
|
||||
+var stdoutHandling = flag.String("stdout", "contest", "Stdout handling: contest, all, tagged, files")
|
||||
+var stderrHandling = flag.String("stderr", "all", "Stderr handling: all, tagged, files")
|
||||
+var filesPrefix = flag.String("prefix", "", "Filename prefix for files generated by -stdout=files and -stderr=files")
|
||||
+var warnRemaining = flag.Bool("warn_unreceived", true, "Warn about messages that remain unreceived after instance's termination")
|
||||
+var stats = flag.Bool("print_stats", false, "Print per-instance statistics")
|
||||
+var traceCommunications = flag.Bool("trace_comm", false, "Print out a trace of all messages exchanged")
|
||||
|
||||
var binaryPath string
|
||||
|
||||
@@ -49,13 +49,13 @@ func writeFile(streamType string, i int, r io.Reader) error {
|
||||
}
|
||||
|
||||
func Usage() {
|
||||
- fmt.Fprintf(os.Stderr, "Uzycie: %s [opcje] program_do_uruchomienia\n", os.Args[0])
|
||||
+ fmt.Fprintf(os.Stderr, "Usage: %s [flags] binary_to_run\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
- fmt.Fprintf(os.Stderr, `Sposoby obsługi wyjścia:
|
||||
- contest: Wymuszaj, żeby tylko jedna instancja pisała na standardowe wyjście. Przekieruj jej wyjście na standardowe wyjście tego programu.
|
||||
- all: Przekieruj wyjście wszystkich instancji na analogiczne wyjście tego programu.
|
||||
- tagged: Przekieruj wyjście wszystkich instancji na analogiczne wyjście tego programy, dopisując numer instancji na początku każdej linijki.
|
||||
- files: Zapisz wyjście każdej instancji w osobnym pliku.
|
||||
+ fmt.Fprintf(os.Stderr, `Output handling modes:
|
||||
+ contest: Fail if more than one instance write any output. Redirect the output to the standard output of this program.
|
||||
+ all: Redirect all the instances' outputs to the corresponding output of this program.
|
||||
+ tagged: Redirect all the instances' outputs to the corresponding output of this program, while prefixing each line with instance number.
|
||||
+ files: Store output of each instance in a separate file.
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
if flag.NArg() != 1 {
|
||||
- fmt.Fprintf(os.Stderr, "Nie podałeś programu do uruchomienia\n")
|
||||
+ fmt.Fprintf(os.Stderr, "Specify the binary name\n")
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func main() {
|
||||
}
|
||||
|
||||
if *nInstances < 1 || *nInstances > MaxInstances {
|
||||
- fmt.Fprintf(os.Stderr, "Liczba instancji powinna być z zakresu [1,%d], a podałeś %d\n", MaxInstances, *nInstances)
|
||||
+ fmt.Fprintf(os.Stderr, "Number of instances should be from [1,%d], but %d was given\n", MaxInstances, *nInstances)
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -93,7 +93,7 @@ func main() {
|
||||
case "files":
|
||||
writeStdout = func(i int, r io.Reader) error { return writeFile("stdout", i, r) }
|
||||
default:
|
||||
- fmt.Fprintf(os.Stderr, "Niewłaściwa metoda obsługi standardowego wyjścia: %s", *stdoutHandling)
|
||||
+ fmt.Fprintf(os.Stderr, "Invalid stdout handling mode: %s", *stdoutHandling)
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -105,7 +105,7 @@ func main() {
|
||||
case "files":
|
||||
writeStdout = func(i int, r io.Reader) error { return writeFile("stderr", i, r) }
|
||||
default:
|
||||
- fmt.Fprintf(os.Stderr, "Niewłaściwa metoda obsługi standardowego wyjścia diagnostycznego: %s", *stdoutHandling)
|
||||
+ fmt.Fprintf(os.Stderr, "Inalid stderr handling mode: %s", *stdoutHandling)
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -186,9 +186,9 @@ func main() {
|
||||
for _, p := range er.RemainingMessages {
|
||||
m[p.To] = append(m[p.To], p.From)
|
||||
}
|
||||
- fmt.Fprintf(os.Stderr, "Uwaga: następujące instancje nie odebrały wszystkich wiadomości dla nich przeznaczonych nim się zakończyły:\n")
|
||||
+ fmt.Fprintf(os.Stderr, "Warning: following instances had some messages left after they've terminated:\n")
|
||||
for dest, srcs := range m {
|
||||
- fmt.Fprintf(os.Stderr, "Instancja %d nie odebrała wiadomości od instancji: ", dest)
|
||||
+ fmt.Fprintf(os.Stderr, "Instance %d did not receive message from instances: ", dest)
|
||||
for _, src := range srcs {
|
||||
fmt.Fprintf(os.Stderr, "%d ", src)
|
||||
}
|
||||
@@ -209,10 +209,10 @@ func main() {
|
||||
lastInstance = i
|
||||
}
|
||||
}
|
||||
- fmt.Fprintf(os.Stderr, "Czas trwania: %v (najdłużej działająca instancja: %d)\n", maxTime, lastInstance)
|
||||
+ fmt.Fprintf(os.Stderr, "Duration: %v (longest running instance: %d)\n", maxTime, lastInstance)
|
||||
if *stats {
|
||||
w := tabwriter.NewWriter(os.Stderr, 2, 1, 1, ' ', 0)
|
||||
- io.WriteString(w, "Instancja\tCzas całkowity\tCzas CPU\tCzas oczekiwania\tWysłane wiadomości\tWysłane bajty\n")
|
||||
+ io.WriteString(w, "Instance\tTotal time\tCPU time\tTime spent waiting\tSent messages\tSent bytes\n")
|
||||
for i, instance := range instances {
|
||||
fmt.Fprintf(w, "%d\t%v\t%v\t%v\t%d\t%d\n", i, instance.TimeRunning+instance.TimeBlocked, instance.TimeRunning, instance.TimeBlocked, instance.MessagesSent, instance.MessageBytesSent)
|
||||
}
|
||||
diff --git route.go route.go
|
||||
index f2df9ad..76875a5 100644
|
||||
--- route.go
|
||||
+++ route.go
|
||||
@@ -16,7 +16,7 @@ type ErrDeadlock struct {
|
||||
}
|
||||
|
||||
func (e ErrDeadlock) Error() string {
|
||||
- return "wszystkie niezakończone instancje są zablokowane"
|
||||
+ return "all instances have either terminated or are deadlocked"
|
||||
}
|
||||
|
||||
// An ErrRemainingMessages represents a situation when some messages were left
|
||||
@@ -28,7 +28,7 @@ type ErrRemainingMessages struct {
|
||||
}
|
||||
|
||||
func (e ErrRemainingMessages) Error() string {
|
||||
- return "po zakończeniu działania pozostały nieodebrane wiadomości"
|
||||
+ return "some messages were left unreceived after all instances have terminated"
|
||||
}
|
||||
|
||||
// requestAndID represents a request r made by instance id
|
||||
diff --git util.go util.go
|
||||
index 7a16ab0..e1d1f71 100644
|
||||
--- util.go
|
||||
+++ util.go
|
||||
@@ -25,7 +25,7 @@ func (w *contestStdoutWriter) Write(buf []byte) (int, error) {
|
||||
if w.cs.chosenInstance == w.id {
|
||||
return w.cs.Output.Write(buf)
|
||||
} else {
|
||||
- return 0, fmt.Errorf("instancja %d zaczęła już wypisywać wyjście", w.cs.chosenInstance)
|
||||
+ return 0, fmt.Errorf("instance %d has already started to write output", w.cs.chosenInstance)
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.2.0.rc0.207.ga3a616c
|
||||
|
Reference in New Issue
Block a user