xref: /aosp_15_r20/external/chromium-trace/catapult/systrace/profile_chrome/ui.py (revision 1fa4b3da657c0e9ad43c0220bacf9731820715a5)
1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import logging
6import select
7import sys
8
9
10def PrintMessage(heading, eol='\n'):
11  sys.stdout.write('%s%s' % (heading, eol))
12  sys.stdout.flush()
13
14
15def WaitForEnter(timeout):
16  select.select([sys.stdin], [], [], timeout)
17
18
19def EnableTestMode():
20  def NoOp(*_, **__):  # pylint: disable=unused-argument
21    pass
22  # pylint: disable=W0601
23  global PrintMessage
24  global WaitForEnter
25  PrintMessage = NoOp
26  WaitForEnter = NoOp
27  logging.getLogger().disabled = True
28