github.com/GuanceCloud/cliutils@v1.1.21/pprofparser/service/parsing/collapse_test.go (about)

     1  package parsing
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestGetPySpySummary(t *testing.T) {
     8  
     9  	summaries, err := summary("testdata")
    10  
    11  	if err != nil {
    12  		t.Error(err)
    13  	}
    14  
    15  	for k, v := range summaries {
    16  		println(k)
    17  		println(v.Type)
    18  		println(v.Unit.Kind, v.Unit.Name, v.Unit.Base)
    19  		println(v.Value)
    20  	}
    21  
    22  }
    23  
    24  func TestParseRawFlameGraph(t *testing.T) {
    25  	flame, selectMap, err := ParseRawFlameGraph("testdata")
    26  
    27  	if err != nil {
    28  		t.Fatal(err)
    29  	}
    30  
    31  	for k, v := range selectMap {
    32  		t.Log(k)
    33  		t.Log(v.Mapping)
    34  		for key, opt := range v.Options {
    35  			t.Log(key)
    36  			t.Log("title:", opt.Title, "Value:", opt.Value, "Unit: ", opt.Unit, "MappingValues:", opt.MappingValues)
    37  			t.Log("")
    38  		}
    39  		t.Log("----------------------------------------")
    40  	}
    41  
    42  	_ = flame
    43  
    44  }