• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# Copyright (C) 2018 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from os import sys, path
17
18import synth_common
19
20file_member = 0
21anon_member = 1
22
23trace = synth_common.create_trace()
24trace.add_packet()
25trace.add_process(1, 0, "init")
26trace.add_process(2, 1, "process_a")
27trace.add_process(3, 1, "process_b")
28
29trace.add_ftrace_packet(0)
30trace.add_rss_stat(100, 2, file_member, 100)
31trace.add_rss_stat(100, 2, anon_member, 200)
32trace.add_oom_score_update(100, 1000, 2)
33trace.add_rss_stat(105, 2, file_member, 50)
34trace.add_oom_score_update(107, -300, 2)
35trace.add_rss_stat(110, 2, anon_member, 100)
36trace.add_rss_stat(120, 2, anon_member, 75)
37trace.add_rss_stat(121, 2, file_member, 95)
38trace.add_oom_score_update(122, 300, 2)
39trace.add_rss_stat(123, 2, anon_member, 200)
40trace.add_rss_stat(124, 2, file_member, 75)
41trace.add_rss_stat(125, 2, file_member, 35)
42trace.add_oom_score_update(126, 0, 2)
43trace.add_rss_stat(126, 2, file_member, 0)
44trace.add_rss_stat(126, 2, anon_member, 0)
45
46trace.add_ftrace_packet(0)
47trace.add_rss_stat(104, 3, file_member, 400)
48trace.add_rss_stat(107, 3, anon_member, 300)
49trace.add_oom_score_update(110, 0, 3)
50trace.add_rss_stat(113, 3, file_member, 75)
51trace.add_rss_stat(114, 3, anon_member, 800)
52trace.add_oom_score_update(115, 600, 3)
53trace.add_rss_stat(117, 3, file_member, 25)
54trace.add_rss_stat(118, 3, file_member, 80)
55trace.add_oom_score_update(118, -500, 3)
56trace.add_rss_stat(123, 3, file_member, 85)
57trace.add_rss_stat(126, 3, anon_member, 600)
58trace.add_rss_stat(129, 3, file_member, 90)
59trace.add_oom_score_update(130, 200, 3)
60trace.add_rss_stat(130, 2, file_member, 0)
61trace.add_rss_stat(130, 2, anon_member, 0)
62
63sys.stdout.buffer.write(trace.trace.SerializeToString())
64