예제 #1
0
func main() {

	fmt.Print("GOPROCS:=", runtime.GOMAXPROCS(6))
	runtime.SetCPUProfileRate(-1)
	start := time.Now()

	user1 := NewSetup()
	user2 := NewSetup()
	user3 := NewSetup()
	// user4 := NewSetup()
	// user5 := NewSetup()
	// fmt.Printf("\nLink %v", user1)
	// fmt.Printf("\nLink %v", user2)
	data, err := ioutil.ReadFile("settings.json")
	if err != nil {
		log.Print("Unable to Read File : ", err)
	}
	result := chipset.GetMetaInfo(data, "Modem1")
	fmt.Print("Found Setting : ", result, "len = ", len(result))
	var jsons string = `{"NBlocks":100,"snr":"0:2:16","SF":1}`
	var mymodem core.Modem
	mymodem.SetName("Modem2")
	mymodem.SetJson(data)

	fmt.Print("SOMETHING", string(mymodem.GetJson()))
	user1.Set(jsons)
	user2.Set(jsons)
	user3.Set(jsons)
	// user3.Set(jsons)
	// user4.Set(jsons)
	// user5.Set(jsons)
	fmt.Printf("Starting simulation ...")

	fmt.Printf("\n started user 1")
	go user1.Run()
	fmt.Printf("\n started user 2")
	go user2.Run()
	// go user3.Run()
	// go user4.Run()

	// 	user1.Run()
	// 	user2.Run()
	// 	user3.Run()
	// 	user4.Run()
	fmt.Printf("\n started user 3")
	user3.Run()

	// time.Sleep(10 * time.Second)
	fmt.Print("\n Elapsed : ", time.Since(start))

}
예제 #2
0
파일: cdmachip.go 프로젝트: postfix/gocomm
func (m *CDMA) SetJson(data []byte) {
	m.cdmaMeta.setDefaults()
	result := chipset.GetMetaInfo(data, m.Name())
	m.update(result)
}