Ejemplo n.º 1
0
func BenchmarkHouse(b *testing.B) {
	b.StopTimer()
	houseBase = loadImage("house.png")
	readingsSingleton = newReadingServer()
	go processReadings()
	var err error
	conf, err = houseconf.LoadConfig("houseconf/house.json")
	if err != nil {
		b.Fatalf("Error loading config: %v", err)
	}

	for k, r := range conf.Rooms {
		name := r.SN
		if name == "" {
			name = k
		}
		readingsSingleton.newReading(reading{time.Now(),
			name,
			27.73,
		})
	}

	b.StartTimer()

	for i := 0; i < b.N; i++ {
		drawHouse()
	}
}
Ejemplo n.º 2
0
func main() {
	flag.Parse()
	var err error

	houseBase = loadImage("house.png")
	thermImage = loadImage("therm-c.gif")
	conf, err = houseconf.LoadConfig("houseconf/house.json")

	if err != nil {
		log.Fatalf("Error reading config: %v", err)
	}

	err = readNet()
	if err != nil {
		log.Fatalf("Error reading the net:  %v", err)
	}

	if *couchURL != "" {
		readingsSingleton.register(couchLoop())
	}

	addr := ":7777"
	serveWeb(addr)
}