Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Add CoreRT package reference and clean up csproj. (#2148)
Browse files Browse the repository at this point in the history
* Add CoreRT package reference and clean up csproj.

* Add GC allocation measurement.
  • Loading branch information
ahsonkhan authored Mar 6, 2018
1 parent 38cb875 commit 9b9d730
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
22 changes: 14 additions & 8 deletions samples/AzCopyCore/AzCopyCore/AzCopyCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeFrameworkVersion>2.1.0-preview2-26209-04</RuntimeFrameworkVersion>
<CoreFxPackageVersion>4.5.0-preview2-26213-06</CoreFxPackageVersion>
<CoreFxLabPackageVersion>0.1.0-preview2-180213-4</CoreFxLabPackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -17,14 +19,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Azure.Experimental" Version="0.1.0-preview2-180213-4" />
<PackageReference Include="System.Buffers.Experimental" Version="0.1.0-preview2-180213-4" />
<PackageReference Include="System.IO.Pipelines" Version="0.1.0-preview2-180213-4" />
<PackageReference Include="System.Memory" Version="4.5.0-preview2-26213-06" />
<PackageReference Include="System.Text.Http" Version="0.1.0-preview2-180213-4" />
<PackageReference Include="System.Text.Http.Parser" Version="0.1.0-preview2-180213-4" />
<PackageReference Include="System.Text.Utf8String" Version="0.1.0-preview2-180214-3" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.0-preview2-26213-06" />
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-26223-02" />
<PackageReference Include="System.Memory" Version="$(CoreFxPackageVersion)" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="$(CoreFxPackageVersion)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Azure.Experimental" Version="$(CoreFxLabPackageVersion)" />
<PackageReference Include="System.Buffers.Experimental" Version="$(CoreFxLabPackageVersion)" />
<PackageReference Include="System.Text.Http" Version="$(CoreFxLabPackageVersion)" />
<PackageReference Include="System.Text.Http.Parser" Version="$(CoreFxLabPackageVersion)" />
<PackageReference Include="System.Text.Utf8String" Version="$(CoreFxLabPackageVersion)" />
<PackageReference Include="System.IO.Pipelines" Version="$(CoreFxLabPackageVersion)" />
</ItemGroup>

</Project>
11 changes: 10 additions & 1 deletion samples/AzCopyCore/AzCopyCore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ static void Main(string[] args)
Log.Listeners.Add(new ConsoleTraceListener());
Log.Switch.Level = SourceLevels.Error;

long before = GC.GetAllocatedBytesForCurrentThread();

var options = new CommandLine(args);
ReadOnlySpan<char> source = options.GetSpan("/Source:");
ReadOnlySpan<char> destination = options.GetSpan("/Dest:");

// transfer from file system to storage
if (destination.StartsWith("http://"))
{
var sw = new Stopwatch();
sw.Start();
TransferDirectoryToStorage(source, destination, options);
sw.Stop();
Console.WriteLine("Elapsed time: " + sw.ElapsedMilliseconds + " ms");
}

// transfer from storage to file system
Expand All @@ -48,6 +54,9 @@ static void Main(string[] args)

else { PrintUsage(); }

long after = GC.GetAllocatedBytesForCurrentThread();
Console.WriteLine($"GC Allocations: {after - before} bytes");

if (Debugger.IsAttached)
{
Console.WriteLine("Press ENTER to exit ...");
Expand Down Expand Up @@ -96,7 +105,7 @@ static void TransferDirectoryToStorage(ReadOnlySpan<char> localDirectory, ReadOn
// https://github.com/dotnet/corefx/issues/25536
// https://github.com/dotnet/corefx/issues/25539
var storagePath = new string(path) + "/" + Path.GetFileName(filepath);
Console.WriteLine($"Uploaded {filepath} to {storagePath}");

// TODO (pri 3): this loop keeps going through all files, even if the key is wrong
if (CopyLocalFileToStorageFile(client, filepath, storagePath).Result)
{
Expand Down

0 comments on commit 9b9d730

Please sign in to comment.