1 /* 2 * Copyright (C) 2019 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 ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_METHOD_LIST_H_ 18 #define ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_METHOD_LIST_H_ 19 20 #include <stdbool.h> 21 #include <stddef.h> 22 #include <stdint.h> 23 24 #include "jni.h" 25 26 // Unless explicitly mentioned otherwise, the following methods have been 27 // introduced in version 1 API, corresponding to SDK level 31. 28 #define PALETTE_METHOD_LIST(M) \ 29 M(PaletteSchedSetPriority, int32_t tid, int32_t java_priority) \ 30 M(PaletteSchedGetPriority, int32_t tid, /*out*/ int32_t* java_priority) \ 31 M(PaletteWriteCrashThreadStacks, const char* stacks, size_t stacks_len) \ 32 M(PaletteTraceEnabled, /*out*/ bool* enabled) \ 33 M(PaletteTraceBegin, const char* name) \ 34 M(PaletteTraceEnd) \ 35 M(PaletteTraceIntegerValue, const char* name, int32_t value) \ 36 M(PaletteAshmemCreateRegion, const char* name, size_t size, int* fd) \ 37 M(PaletteAshmemSetProtRegion, int, int) \ 38 /* Create the staging directory for on-device signing. */ \ 39 /* `staging_dir` is updated to point to a constant string in the */ \ 40 /* palette implementation. */ \ 41 /* This method is not thread-safe. */ \ 42 M(PaletteCreateOdrefreshStagingDirectory, /*out*/ const char** staging_dir) \ 43 M(PaletteShouldReportDex2oatCompilation, bool*) \ 44 M(PaletteNotifyStartDex2oatCompilation, int source_fd, int art_fd, int oat_fd, int vdex_fd) \ 45 M(PaletteNotifyEndDex2oatCompilation, int source_fd, int art_fd, int oat_fd, int vdex_fd) \ 46 M(PaletteNotifyDexFileLoaded, const char* path) \ 47 M(PaletteNotifyOatFileLoaded, const char* path) \ 48 M(PaletteShouldReportJniInvocations, bool*) \ 49 M(PaletteNotifyBeginJniInvocation, JNIEnv* env) \ 50 M(PaletteNotifyEndJniInvocation, JNIEnv* env) \ 51 \ 52 /* Introduced in version 2 API, corresponding to SDK level 33. */ \ 53 M(PaletteReportLockContention, \ 54 JNIEnv* env, \ 55 int32_t wait_ms, \ 56 const char* filename, \ 57 int32_t line_number, \ 58 const char* method_name, \ 59 const char* owner_filename, \ 60 int32_t owner_line_number, \ 61 const char* owner_method_name, \ 62 const char* proc_name, \ 63 const char* thread_name) \ 64 \ 65 /* Introduced in version 3 API, corresponding to SDK level 34. */ \ 66 /* Calls through to SetTaskProfiles in libprocessgroup to set the */ \ 67 /* [task profile](https:/-/source.android.com/docs/core/perf/cgroups#task-profiles-file) */ \ 68 /* for the given thread id. */ \ 69 /* */ \ 70 /* @param tid The thread id. */ \ 71 /* @param profiles An array of pointers to C strings that list the task profiles to set. */ \ 72 /* @param profiles_len The number of elements in profiles. */ \ 73 /* @return PALETTE_STATUS_OK if the call succeeded. */ \ 74 /* PALETTE_STATUS_FAILED_CHECK_LOG if it failed. */ \ 75 /* PALETTE_STATUS_NOT_SUPPORTED if the implementation no longer supports this */ \ 76 /* call. This can happen at any future SDK level since this function wraps an */ \ 77 /* internal unstable API. */ \ 78 M(PaletteSetTaskProfiles, int32_t tid, const char* const profiles[], size_t profiles_len) \ 79 \ 80 /* Methods in version 4 API, corresponding to SDK level 36. */ \ 81 \ 82 /* Retrieves the debug store as a string. */ \ 83 /* */ \ 84 /* This function retrieves debug information stored in a predefined debug store. */ \ 85 /* The information retrieved are used for debugging and logging purposes. */ \ 86 /* */ \ 87 /* @param result A pointer to a null-terminated character array where the retrieved */ \ 88 /* string will be stored. */ \ 89 /* @param max_size The maximum number of characters to be copied into the result, */ \ 90 /* including the null terminator. It is the caller's responsibility */ \ 91 /* to ensure that the pointed by result is large enough to store */ \ 92 /* up to max_size characters. */ \ 93 /* @return PALETTE_STATUS_OK if the call succeeded. */ \ 94 /* PALETTE_STATUS_INVALID_ARGUMENT if the pointer is a nullptr or max_size is 0 */ \ 95 M(PaletteDebugStoreGetString, char* result, size_t max_size) 96 97 #endif // ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_METHOD_LIST_H_ 98