123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174(*****************************************************************************)(* Open Source License *)(* Copyright (c) 2018 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)openGcletgc_stat_encoding=letopenData_encodinginconv(fun{minor_words;promoted_words;major_words;minor_collections;major_collections;forced_major_collections;heap_words;heap_chunks;live_words;live_blocks;free_words;free_blocks;largest_free;fragments;compactions;top_heap_words;stack_size;}->((minor_words,promoted_words,major_words,minor_collections,major_collections,forced_major_collections),((heap_words,heap_chunks,live_words,live_blocks,free_words),(free_blocks,largest_free,fragments,compactions,top_heap_words,stack_size))))(fun((minor_words,promoted_words,major_words,minor_collections,major_collections,forced_major_collections),((heap_words,heap_chunks,live_words,live_blocks,free_words),(free_blocks,largest_free,fragments,compactions,top_heap_words,stack_size)))->{minor_words;promoted_words;major_words;minor_collections;major_collections;forced_major_collections;heap_words;heap_chunks;live_words;live_blocks;free_words;free_blocks;largest_free;fragments;compactions;top_heap_words;stack_size;})(merge_objs(obj6(req"minor_words"float)(req"promoted_words"float)(req"major_words"float)(req"minor_collections"int31)(req"major_collections"int31)(req"forced_major_collections"int31))(merge_objs(obj5(req"heap_words"int31)(req"heap_chunks"int31)(req"live_words"int31)(req"live_blocks"int31)(req"free_words"int31))(obj6(req"free_blocks"int31)(req"largest_free"int31)(req"fragments"int31)(req"compactions"int31)(req"top_heap_words"int31)(req"stack_size"int31))))letproc_stat_encoding=letopenMemoryinletopenData_encodinginunion~tag_size:`Uint8[case(Tag0)(conv(fun{page_size;size;resident;shared;text;lib;data;dt}->(page_size,size,resident,shared,text,lib,data,dt))(fun(page_size,size,resident,shared,text,lib,data,dt)->{page_size;size;resident;shared;text;lib;data;dt})(obj8(req"page_size"int31)(req"size"int64)(req"resident"int64)(req"shared"int64)(req"text"int64)(req"lib"int64)(req"data"int64)(req"dt"int64)))~title:"Linux_proc_statm"(functionStatmx->Somex|_->None)(functionres->Statmres);case(Tag1)(conv(fun{page_size;mem;resident}->(page_size,mem,resident))(fun(page_size,mem,resident)->{page_size;mem;resident})(obj3(req"page_size"int31)(req"mem"float)(req"resident"int64)))~title:"Darwin_ps"(functionPsx->Somex|_->None)(functionres->Psres);]moduleS=structletgc=Tezos_rpc.Service.get_service~description:"Gets stats from the OCaml Garbage Collector"~query:Tezos_rpc.Query.empty~output:gc_stat_encodingTezos_rpc.Path.(root/"stats"/"gc")letmemory=Tezos_rpc.Service.get_service~description:"Gets memory usage stats"~query:Tezos_rpc.Query.empty~output:proc_stat_encodingTezos_rpc.Path.(root/"stats"/"memory")endletgcctxt=Tezos_rpc.Context.make_callS.gcctxt()()()letmemoryctxt=Tezos_rpc.Context.make_callS.memoryctxt()()()