1 /* 2 * Copyright (C) 2020 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 */ 16 17 #ifndef INCLUDE_PERFETTO_EXT_BASE_VERSION_H_ 18 #define INCLUDE_PERFETTO_EXT_BASE_VERSION_H_ 19 20 namespace perfetto { 21 namespace base { 22 23 // The returned pointer is a static string and safe to pass around. 24 // Returns a human readable string currently of the approximate form: 25 // Perfetto v42.1-deadbeef0 (deadbeef03c641e4b4ea9cf38e9b5696670175a9) 26 // However you should not depend on the format of this string. 27 // It maybe not be possible to determine the version. In which case the 28 // string will be of the approximate form: 29 // Perfetto v0.0 (unknown) 30 const char* GetVersionString(); 31 32 // The returned pointer is a static string and safe to pass around. 33 // Returns the short code used to identity the version: 34 // v42.1-deadbeef0 35 // It maybe not be possible to determine the version. In which case 36 // this returns nullptr. 37 // This can be compared with equality to other 38 // version codes to detect matched builds (for example to see if 39 // trace_processor_shell and the UI were built at the same revision) 40 // but you should not attempt to parse it as the format may change 41 // without warning. 42 const char* GetVersionCode(); 43 44 } // namespace base 45 } // namespace perfetto 46 47 #endif // INCLUDE_PERFETTO_EXT_BASE_VERSION_H_ 48