Skip to content

Commit

Permalink
Updated the license header for the new files linkedmap.go and linkedm…
Browse files Browse the repository at this point in the history
…ap_test.go

Also resolved a couple of golangci linter warnings.

Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Jan 2, 2023
1 parent ed3c570 commit d2ec177
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
17 changes: 14 additions & 3 deletions tools/rw-benchmark/linkedmap.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
// Copyright (c) 2019, Benjamin Wang ([email protected]). All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
// Copyright 2022 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package linkedmap implements a linked hashmap, based on a map and a doubly linked list. The iteration ordering is normally
// the order in which keys were inserted into the map, or the order in which the keys were accessed if the accessOrder flag is set.
Expand Down Expand Up @@ -115,7 +126,7 @@ func (lm *linkedMap) IsEmpty() bool {
}

func (lm *linkedMap) Put(k, v interface{}) interface{} {
var retVal interface{} = nil
var retVal interface{}
if oldElement, ok := lm.data[k]; ok {

retVal = oldElement.value
Expand Down
15 changes: 13 additions & 2 deletions tools/rw-benchmark/linkedmap_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
// Copyright (c) 2019, Benjamin Wang ([email protected]). All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
// Copyright 2022 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

Expand Down
8 changes: 4 additions & 4 deletions tools/rw-benchmark/plot_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ func loadCSV(filename string) (LinkedMap, error) {
if len(qps) != 2 {
return nil, fmt.Errorf("unexpected qps values %q at file %q:%d", rec[j], filename, i)
}
read_qps, err := strconv.ParseFloat(qps[0], 64)
readQPS, err := strconv.ParseFloat(qps[0], 64)
if err != nil {
return nil, fmt.Errorf("failed to parse read qps %q at file %q:%d, error: %w", qps[0], filename, i, err)
}
sumReadQPS += read_qps
write_qps, err := strconv.ParseFloat(qps[1], 64)
sumReadQPS += readQPS
writeQPS, err := strconv.ParseFloat(qps[1], 64)
if err != nil {
return nil, fmt.Errorf("failed to parse write qps %q at file %q:%d, error: %w", qps[1], filename, i, err)
}
sumWriteQPS += write_qps
sumWriteQPS += writeQPS
}
avgReadQPS, avgWriteQPS = sumReadQPS/float64(cnt), sumWriteQPS/float64(cnt)

Expand Down

0 comments on commit d2ec177

Please sign in to comment.