@@ -71,6 +71,9 @@ type ProofReceiverLogic struct {
7171 validateFailureProverTaskStatusNotOk prometheus.Counter
7272 validateFailureProverTaskTimeout prometheus.Counter
7373 validateFailureProverTaskHaveVerifier prometheus.Counter
74+ proverSpeed * prometheus.GaugeVec
75+ provingTime prometheus.Gauge
76+ evm_cycle_per_gas prometheus.Gauge
7477
7578 ChunkTask provertask.ProverTask
7679 BundleTask provertask.ProverTask
@@ -79,6 +82,7 @@ type ProofReceiverLogic struct {
7982
8083// NewSubmitProofReceiverLogic create a proof receiver logic
8184func NewSubmitProofReceiverLogic (cfg * config.ProverManager , chainCfg * params.ChainConfig , db * gorm.DB , vf * verifier.Verifier , reg prometheus.Registerer ) * ProofReceiverLogic {
85+
8286 return & ProofReceiverLogic {
8387 chunkOrm : orm .NewChunk (db ),
8488 batchOrm : orm .NewBatch (db ),
@@ -133,6 +137,18 @@ func NewSubmitProofReceiverLogic(cfg *config.ProverManager, chainCfg *params.Cha
133137 Name : "coordinator_validate_failure_submit_have_been_verifier" ,
134138 Help : "Total number of submit proof validate failure proof have been verifier." ,
135139 }),
140+ evm_cycle_per_gas : promauto .With (reg ).NewGauge (prometheus.GaugeOpts {
141+ Name : "evm_circuit_cycle_per_gas" ,
142+ Help : "VM cycles cost for a gas unit cost in evm execution" ,
143+ }),
144+ provingTime : promauto .With (reg ).NewGauge (prometheus.GaugeOpts {
145+ Name : "chunk_proving_time" ,
146+ Help : "Wall clock time for chunk proving in second" ,
147+ }),
148+ proverSpeed : promauto .With (reg ).NewGaugeVec (prometheus.GaugeOpts {
149+ Name : "prover_speed" ,
150+ Help : "Cycle against running time of prover (in mhz)" ,
151+ }, []string {"type" , "phase" }),
136152 }
137153}
138154
@@ -204,12 +220,32 @@ func (m *ProofReceiverLogic) HandleZkProof(ctx *gin.Context, proofParameter coor
204220 return unmarshalErr
205221 }
206222 success , verifyErr = m .verifier .VerifyChunkProof (chunkProof , hardForkName )
223+ if stat := chunkProof .VmProof .Stat ; stat != nil {
224+ if g , _ := m .proverSpeed .GetMetricWithLabelValues ("chunk" , "exec" ); g != nil {
225+ g .Set (float64 (stat .TotalCycle ) / float64 (stat .ExecutionTimeMills * 1000 ))
226+ }
227+ if g , _ := m .proverSpeed .GetMetricWithLabelValues ("chunk" , "proving" ); g != nil {
228+ g .Set (float64 (stat .TotalCycle ) / float64 (stat .ProvingTimeMills * 1000 ))
229+ }
230+ cycle_per_gas := float64 (stat .TotalCycle ) / float64 (chunkProof .MetaData .TotalGasUsed )
231+ m .evm_cycle_per_gas .Set (cycle_per_gas )
232+ m .provingTime .Set (float64 (stat .ProvingTimeMills ) / 1000 )
233+ }
234+
207235 case message .ProofTypeBatch :
208236 batchProof := & message.OpenVMBatchProof {}
209237 if unmarshalErr := json .Unmarshal ([]byte (proofParameter .Proof ), & batchProof ); unmarshalErr != nil {
210238 return unmarshalErr
211239 }
212240 success , verifyErr = m .verifier .VerifyBatchProof (batchProof , hardForkName )
241+ if stat := batchProof .VmProof .Stat ; stat != nil {
242+ if g , _ := m .proverSpeed .GetMetricWithLabelValues ("batch" , "exec" ); g != nil {
243+ g .Set (float64 (stat .TotalCycle ) / float64 (stat .ExecutionTimeMills * 1000 ))
244+ }
245+ if g , _ := m .proverSpeed .GetMetricWithLabelValues ("batch" , "proving" ); g != nil {
246+ g .Set (float64 (stat .TotalCycle ) / float64 (stat .ProvingTimeMills * 1000 ))
247+ }
248+ }
213249 case message .ProofTypeBundle :
214250 bundleProof := & message.OpenVMBundleProof {}
215251 if unmarshalErr := json .Unmarshal ([]byte (proofParameter .Proof ), & bundleProof ); unmarshalErr != nil {
0 commit comments