예제 #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)
}
예제 #2
0
파일: tdgrep.go 프로젝트: slotties/jtdutils
func grepThreads(parser tdformat.Parser, filters Filters, out io.Writer) {
	for parser.NextThread() {
		if parser.SwitchedDump() {
			// TODO: print dump start
		}

		thread := parser.Thread()
		if isMatching(&thread, &filters) {
			fmt.Fprintln(out, thread.TextContent)
		}
	}
}
예제 #3
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
}
예제 #4
0
파일: tdls.go 프로젝트: slotties/jtdutils
func listThreads(parser tdformat.Parser, conf Conf, out io.Writer) {
	// TODO: print header
	var threads []tdformat.Thread
	sorter := NewSortableThreads(nil, conf.sortBy, conf.reverseOrder)

	for parser.NextThread() {
		if parser.SwitchedDump() {
			printThreads(threads[0:], &sorter, conf, out)
			threads = make([]tdformat.Thread, 0)
		}

		threads = append(threads, parser.Thread())
	}

	// Flush the recorded list of threads
	//sorter = NewSortableThreads(threads, sortBy, reverseOrder)
	printThreads(threads[0:], &sorter, conf, out)
}