Example #1
0
func listLocks(parser tdformat.Parser, minWaitingThreads int, lockObjectClass string, out io.Writer) {
	locks := Locks{}

	for parser.NextThread() {
		if parser.SwitchedDump() {
			printLocks(locks, minWaitingThreads, out)

			dump := parser.Dump()
			locks = Locks{
				&dump,
				make(map[string]LockedThreads, 0),
			}
		}

		thread := parser.Thread()
		if len(thread.Locks) > 0 {
			for _, lock := range thread.Locks {
				if lockObjectClass == "" || lockObjectClass == lock.ClassName {
					rememberLock(&locks, &lock, &thread)
				}
			}
		}
	}

	printLocks(locks, minWaitingThreads, out)
}
Example #2
0
func allStats(parser tdformat.Parser) []StateStats {
	stats := make([]StateStats, 0)
	var currentStats StateStats

	for parser.NextThread() {
		if parser.SwitchedDump() {
			currentStats = newStats(parser.Dump())
			stats = append(stats, currentStats)
		}
		currentStats.stats[parser.Thread().State]++
	}

	return stats
}