[eae5403] | 1 | #!/usr/bin/env python |
---|
[d2a2b8a] | 2 | |
---|
[55f8408] | 3 | |
---|
[d2a2b8a] | 4 | import sys, os.path |
---|
| 5 | |
---|
| 6 | if len(sys.argv) > 1 and sys.argv[1] == "config": |
---|
[55f8408] | 7 | print("""\ |
---|
[d2a2b8a] | 8 | graph_title Tahoe File Estimate |
---|
| 9 | graph_vlabel files |
---|
| 10 | graph_category tahoe |
---|
| 11 | graph_info This graph shows the estimated number of files and directories present in the grid |
---|
| 12 | files.label files |
---|
[55f8408] | 13 | files.draw LINE2""") |
---|
[d2a2b8a] | 14 | sys.exit(0) |
---|
| 15 | |
---|
| 16 | # Edit this to point at some subset of storage directories. |
---|
| 17 | node_dirs = [os.path.expanduser("~amduser/prodnet/storage1"), |
---|
| 18 | os.path.expanduser("~amduser/prodnet/storage2"), |
---|
| 19 | os.path.expanduser("~amduser/prodnet/storage3"), |
---|
| 20 | os.path.expanduser("~amduser/prodnet/storage4"), |
---|
| 21 | ] |
---|
| 22 | |
---|
| 23 | sections = ["aa", "ab", "ac", "ad", "ae", "af", "ag", "ah", "ai", "aj"] |
---|
| 24 | # and edit this to reflect your default encoding's "total_shares" value, and |
---|
| 25 | # the total number of servers. |
---|
| 26 | N = 10 |
---|
| 27 | num_servers = 20 |
---|
| 28 | |
---|
| 29 | index_strings = set() |
---|
| 30 | for base in node_dirs: |
---|
| 31 | for section in sections: |
---|
| 32 | sampledir = os.path.join(base, "storage", "shares", section) |
---|
| 33 | indices = os.listdir(sampledir) |
---|
| 34 | index_strings.update(indices) |
---|
| 35 | unique_strings = len(index_strings) |
---|
| 36 | |
---|
| 37 | # the chance that any given file appears on any given server |
---|
| 38 | chance = 1.0 * N / num_servers |
---|
| 39 | |
---|
| 40 | # the chance that the file does *not* appear on the servers that we're |
---|
| 41 | # examining |
---|
| 42 | no_chance = (1-chance) ** len(node_dirs) |
---|
| 43 | |
---|
| 44 | # if a file has a 25% chance of not appearing in our sample, then we need to |
---|
| 45 | # raise our estimate by (1.25/1) |
---|
| 46 | correction = 1+no_chance |
---|
| 47 | #print "correction", correction |
---|
| 48 | |
---|
| 49 | files = unique_strings * (32*32/len(sections)) * correction |
---|
[55f8408] | 50 | print("files.value %d" % int(files)) |
---|