Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 1037803002: Return timestamp of the last recorded interval to the caller of HeapProfiler::GetHeapStats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 int intervals_count_; 1037 int intervals_count_;
1038 int first_interval_index_; 1038 int first_interval_index_;
1039 }; 1039 };
1040 1040
1041 } // namespace 1041 } // namespace
1042 1042
1043 static TestStatsStream GetHeapStatsUpdate( 1043 static TestStatsStream GetHeapStatsUpdate(
1044 v8::HeapProfiler* heap_profiler, 1044 v8::HeapProfiler* heap_profiler,
1045 v8::SnapshotObjectId* object_id = NULL) { 1045 v8::SnapshotObjectId* object_id = NULL) {
1046 TestStatsStream stream; 1046 TestStatsStream stream;
1047 v8::SnapshotObjectId last_seen_id = heap_profiler->GetHeapStats(&stream); 1047 int64_t timestamp = -1;
1048 v8::SnapshotObjectId last_seen_id =
1049 heap_profiler->GetHeapStats(&stream, &timestamp);
1048 if (object_id) 1050 if (object_id)
1049 *object_id = last_seen_id; 1051 *object_id = last_seen_id;
1052 CHECK_NE(-1, timestamp);
1050 CHECK_EQ(1, stream.eos_signaled()); 1053 CHECK_EQ(1, stream.eos_signaled());
1051 return stream; 1054 return stream;
1052 } 1055 }
1053 1056
1054 1057
1055 TEST(HeapSnapshotObjectsStats) { 1058 TEST(HeapSnapshotObjectsStats) {
1056 LocalContext env; 1059 LocalContext env;
1057 v8::HandleScope scope(env->GetIsolate()); 1060 v8::HandleScope scope(env->GetIsolate());
1058 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); 1061 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
1059 1062
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 map.AddRange(ToAddress(0x180), 0x80, 6U); 2764 map.AddRange(ToAddress(0x180), 0x80, 6U);
2762 map.AddRange(ToAddress(0x180), 0x80, 7U); 2765 map.AddRange(ToAddress(0x180), 0x80, 7U);
2763 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); 2766 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180)));
2764 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); 2767 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200)));
2765 CHECK_EQ(3u, map.size()); 2768 CHECK_EQ(3u, map.size());
2766 2769
2767 map.Clear(); 2770 map.Clear();
2768 CHECK_EQ(0u, map.size()); 2771 CHECK_EQ(0u, map.size());
2769 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); 2772 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400)));
2770 } 2773 }
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698