• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright (C) 2017 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Enable lock contention logging.
18if [[ "x$ART_DEFAULT_GC_TYPE" = xGSS ]]; then
19  # NonMovingAlloc operations fail an assertion with the Generational
20  # Semi-Space (GSS) collector (see b/72738921); disable them for now
21  # by explicitly assigning frequencies to operations when the GSS
22  # collector is used.
23  #
24  # Note: The trick to use command substitution to have comments within
25  # a multi-line command is from https://stackoverflow.com/a/12797512.
26  ${RUN} --runtime-option -Xlockprofthreshold:10 "${@}" Main \
27    -oom:0.005           `#   1/200` \
28    -sigquit:0.095       `#  19/200` \
29    -alloc:0.225         `#  45/200` \
30    -largealloc:0.05     `#  10/200` \
31    -nonmovingalloc:0.0  `#   0/200` \
32    -stacktrace:0.1      `#  20/200` \
33    -exit:0.225          `#  45/200` \
34    -sleep:0.125         `#  25/200` \
35    -timedwait:0.05      `#  10/200` \
36    -wait:0.075          `#  15/200` \
37    -queuedwait:0.05     `#  10/200`
38else
39  ${RUN} --runtime-option -Xlockprofthreshold:10 "${@}"
40fi
41return_status1=$?
42
43# Run locks-only mode with stack-dump lock profiling. Reduce the number of total operations from
44# the default 1000 to 100.
45${RUN} --runtime-option -Xlockprofthreshold:10 --runtime-option -Xstackdumplockprofthreshold:20 \
46  "${@}" Main --locks-only -o 100
47return_status2=$?
48
49# Make sure we don't silently ignore an early failure.
50(exit $return_status1) && (exit $return_status2)
51