get_cpu_count.py 474 B

1234567891011121314151617181920212223
  1. # Copyright 2018 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. # This script shows cpu count to specify capacity of action pool.
  5. from __future__ import print_function
  6. import multiprocessing
  7. import sys
  8. def main():
  9. try:
  10. cpu_count = multiprocessing.cpu_count()
  11. except:
  12. cpu_count = 1
  13. print(cpu_count)
  14. return 0
  15. if __name__ == '__main__':
  16. sys.exit(main())