提交 cc424718 编写于 作者: D DoMyJob

Add few log message

Signed-off-by: NDoMyJob <46307927+DoMyJob@users.noreply.github.com>
上级 54881396
......@@ -174,4 +174,9 @@ func (engine *DataSampleEngine) recordTaskResponse(task *TaskDescription, res Re
res,
desc,
}
}
func (engine *DataSampleEngine) String() string {
return fmt.Sprintf("\nDataSampleEngine Info:\n" + engine.config.String() +
"\nqueue: %d\n", len(engine.taskList))
}
\ No newline at end of file
package sampling
import (
"fmt"
)
// Config is the config of sampling engine
type Config struct {
FrequenceInSecond uint32
......@@ -7,6 +11,11 @@ type Config struct {
P2PTimeoutInMS uint32
}
func (config Config) String() string {
return fmt.Sprintf("\nFrequenceInSecond: %d second\nMaxSamplingThread: %d\nP2PTimeoutInMS: %d ms\n",
config.FrequenceInSecond, config.MaxSamplingThread, config.P2PTimeoutInMS)
}
// DefaultOption is the default option of data sample engine
func DefaultOption() *Config {
return &Config{
......
......@@ -194,4 +194,29 @@ func TestStatusError(t *testing.T) {
t.Log("Expected:", se.ReportTaskStatus(task))
}
}
}
func TestTaskFanIn(t *testing.T) {
opt.DebugPrint = true
config := DefaultOption()
config.FrequenceInSecond = 300
n := 10000
hashes, data := createData(1)
p2pNet, p2pNodes := initailP2PMockWithShards(hashes, data, 500)
se, err := NewEngine(p2pNet, config)
if err != nil {
t.Fail()
}
for i:=0;i<n;i++{
task := &TaskDescription{
uint64(i),
hashes[0],
p2pNodes[0],
}
se.RequestSampling(task)
}
t.Log(se)
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册