github.com/matrixorigin/matrixone@v0.7.0/pkg/frontend/profiler.go (about) 1 // Copyright 2021 Matrix Origin 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 15 package frontend 16 17 /* 18 * 19 phase statistics 20 */ 21 type PhaseProfiler interface { 22 /** 23 start the statistics for the phase. 24 name: the name of the phase 25 */ 26 StartPhase(name string) 27 28 /** 29 stop the statistics for the phase 30 */ 31 EndPhase() 32 33 // ToString convert the phase info into the string 34 ToString() string 35 } 36 37 // OperatorProfiler : operator statistics 38 type OperatorProfiler interface { 39 //start the statistics for the operator 40 StartOperator(operator interface{}) 41 42 //end the statistics for the operator 43 EndOperator() 44 45 //add the operator into the profiler 46 AddOperator(operator interface{}) 47 48 //convert the operator info into the string 49 ToString() string 50 } 51 52 // query statistics 53 type QueryProfiler interface { 54 //start the statistics for the query 55 StartQuery(string) 56 57 //stop the statistics for the query 58 EndQuery() 59 60 //generate the statistics tree from the physical plan 61 InitWithPlan() 62 63 //add OperatorProfiler information into the query profiler 64 AddOperatorProfiler(OperatorProfiler) 65 66 //convert the profiler into the string 67 ToString() 68 }