M public/index.html => public/index.html +3 -0
@@ 4,6 4,9 @@
<p>This is a database of Direct Rendering Manager dumps. This database is
used to keep track of GPUs and DRM driver features support.</p>
+<p>The database currently contains {{ .NumSnapshots }} snapshots with
+{{ .NumDevices }} devices and {{ .NumDrivers }} drivers.</p>
+
<h2>Browse</h2>
<ul>
<li><a href="/drivers">Drivers</a></li>
M server.go => server.go +24 -2
@@ 75,9 75,31 @@ func New() *echo.Echo {
}
e.GET("/", func(c echo.Context) error {
- return c.Render(http.StatusOK, "index.html", struct {
+ data := struct {
Host string
- }{c.Request().Host})
+ NumSnapshots int
+ NumDevices int
+ NumDrivers int
+ }{}
+
+ data.Host = c.Request().Host
+
+ devices := make(map[string]struct{})
+ drivers := make(map[string]struct{})
+ err := db.Walk(func(k string, n *drmtree.Node) error {
+ data.NumSnapshots++
+ devices[n.Device.BusID()] = struct{}{}
+ drivers[n.Driver.Name] = struct{}{}
+ return nil
+ })
+ if err != nil {
+ return err
+ }
+
+ data.NumDevices = len(devices)
+ data.NumDrivers = len(drivers)
+
+ return c.Render(http.StatusOK, "index.html", &data)
})
e.POST("/submit", func(c echo.Context) error {