1// Copyright (C) 2022 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15import m from 'mithril'; 16 17import {Probe, ProbeAttrs} from '../record_widgets'; 18import {RecordingSectionAttrs} from './recording_sections'; 19 20export class GpuSettings implements m.ClassComponent<RecordingSectionAttrs> { 21 view({attrs}: m.CVnode<RecordingSectionAttrs>) { 22 return m( 23 `.record-section${attrs.cssClass}`, 24 m(Probe, { 25 title: 'GPU frequency', 26 img: 'rec_cpu_freq.png', 27 descr: 'Records gpu frequency via ftrace', 28 setEnabled: (cfg, val) => (cfg.gpuFreq = val), 29 isEnabled: (cfg) => cfg.gpuFreq, 30 } as ProbeAttrs), 31 m(Probe, { 32 title: 'GPU memory', 33 img: 'rec_gpu_mem_total.png', 34 descr: `Allows to track per process and global total GPU memory usages. 35 (Available on recent Android 12+ kernels)`, 36 setEnabled: (cfg, val) => (cfg.gpuMemTotal = val), 37 isEnabled: (cfg) => cfg.gpuMemTotal, 38 } as ProbeAttrs), 39 m(Probe, { 40 title: 'GPU work period', 41 img: 'rec_cpu_voltage.png', 42 descr: `Allows to track per package GPU work. 43 (Available on recent Android 14+ kernels)`, 44 setEnabled: (cfg, val) => (cfg.gpuWorkPeriod = val), 45 isEnabled: (cfg) => cfg.gpuWorkPeriod, 46 } as ProbeAttrs), 47 ); 48 } 49} 50