Created
September 14, 2010 02:50
-
-
Save nsf/578445 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| type TableEntry struct { | |
| exectype string | |
| on int | |
| on2 int | |
| on3 int | |
| } | |
| const header = ` | |
| ┌─────────────────┬───────────┬───────────┬───────────┐ | |
| │ Exec Type │ O(n) │ O(n²) │ O(n³) │ | |
| ├─────────────────┼───────────┼───────────┼───────────┤ | |
| ` | |
| const footer = ` | |
| └─────────────────┴───────────┴───────────┴───────────┘ | |
| ` | |
| func WriteTable(entries []TableEntry) { | |
| fmt.Print(header[1:]) | |
| for _, e := range entries { | |
| fmt.Printf("│ %-15s │ %9d │ %9d │ %9d │\n", e.exectype, e.on, e.on2, e.on3) | |
| } | |
| fmt.Print(footer[1:]) | |
| } | |
| func main() { | |
| table := []TableEntry{ | |
| TableEntry{"1 Thread", 56456, 253235, 5345345}, | |
| TableEntry{"2 Thread", 12414, 436367, 3463456}, | |
| TableEntry{"3 Thread", 34965, 767565, 9986564}, | |
| } | |
| WriteTable(table) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment